Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / Calling FO - OData act...
Finance forum
Answered

Calling FO - OData action using Postman

Posted on by 85

Hi Team

I wrote an Odata action method in the custom data entity, however when calling this method via Postman it throws the below error: Any help would be appreciated

OData action code below:
[SysODataAction('getInfo', false)]]
public static str getInfo(CustTable _custTable)
{
    return strFmt("%1/%2", _custTable.AccountNum, _custTable.CreditLimit);
}
  • Verified answer
    huijij Profile Picture
    huijij 19,803 on at
    RE: Calling FO - OData action using Postman

    Hi Rahul,

    Agree with Anitha, your request URI must follow the format

    1.[Your organization's root URL]/data/[Your data entity]/Microsoft.Dynamics.DataEntities.getInfo

    2.The method is decorated with [SysODataActionAttribute]

    Here is a example for OData action using Postman:

    http://vishwad365fo.blogspot.com/2018/05/testing-odata-actions-in-d365.html

    https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/data-entities/third-party-service-test

    regards

  • Verified answer
    AnithaEswaran Profile Picture
    AnithaEswaran 2,030 on at
    RE: Calling FO - OData action using Postman

    Hi,

    You can call the metadata to check if the odataaction is created properly.

    Use GET request in postman and call this URL

    url.cloudax.dynamics.com/.../$metadata

    This takes sometime to return the result. In this result, search if your odata action method exists. If it doesnt exist, then you need to correct your code.

    If I were you , I would decorate my odata action like the below :

    /// <summary>

       /// OData Action to check info

       /// </summary>

       [SysODataActionAttribute("getInfo", false),

        SysODataCollectionAttribute("accountNum", Types::String),    

        SysODataCollectionAttribute("return", Types::String)]

       public static void getInfo(CustAccount accountNum)

      {

          //Do a select with account num rather than passing the cust table object

       }

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,459 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,783 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans