Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

Fetch value from X++ for oData Filter query

(0) ShareShare
ReportReport
Posted on by 129
I am trying to find the value of Odata link:
https://F&Olink/data/Dataentityname(InventSiteIdList='inv1', dataAreaId='dat')/Microsoft.Dynamics.DataEntities.GetColorsByAvailability2
  I am using the below code :
 
 [SysODataActionAttribute(/GetColorsByAvailability2/, false),
        SysODataCollectionAttribute(/InventSiteIdList/, Types::String),
        SysODataCollectionAttribute(/return/, Types::String)]
        public static str GetColorsByAvailability2(Str _InventSiteIdList)
    {
        info(strFmt(/%1 invent/,_InventSiteIdList));
        return _InventSiteIdList;
    }
also method with parameters like:
 
  [SysODataActionAttribute(/GetColors/, true),
    SysODataCollectionAttribute(/return/, Types::Record, /CarColor/)]
    public List GetColorsByAvailability(boolean onlyAvailableVehicles)
    {
        if(onlyAvailableVehicles == noyes::Yes)
        {
            info('yes');
        }
        else
        {
            info('no');
        
        }
        List returnList = new List(Types::Record);
        // do something
        return returnList;
    }

  I wanted to find the method from where I can the value of odata. And where should I put breakpoint to debug and find the values of odata filters
  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,934 Most Valuable Professional on at
    Fetch value from X++ for oData Filter query
    As I remember, the URL should be [Organization Root URL]/data/[DataEntityCollectionName]/Microsoft.Dynamics.DataEntities.GetColorsByAvailability2.
     
    Parameters should be in a JSON object passed in the request body.
  • aayushii Profile Picture
    aayushii 129 on at
    Fetch value from X++ for oData Filter query
     by URLHi Martin,
     
    Thank you for the quick response.
    I wanted to know how to call GetColorsByAvailability2() using  URL what will be the syntax for it.
  • Martin Dráb Profile Picture
    Martin Dráb 230,934 Most Valuable Professional on at
    Fetch value from X++ for oData Filter query
    Neither of them will give you OData filters.
     
    GetColorsByAvailability() is an instance method, therefore it has a reference to an entity record (in a variable called this) and a single parameter: onlyAvailableVehicles. Of course, if you selected a record by a field value, you can see the value in the field (e.g. this.InventSiteIdList).
     
    GetColorsByAvailability2() is a static method and all it knows is the value of its parameter (_InventSiteIdList).

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,111 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,934 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans