Announcements
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
[SysODataAction('getInfo', false)]] public static str getInfo(CustTable _custTable) { return strFmt("%1/%2", _custTable.AccountNum, _custTable.CreditLimit); }
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
regards
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
}
André Arnaud de Cal...
294,099
Super User 2025 Season 1
Martin Dráb
232,866
Most Valuable Professional
nmaenpaa
101,158
Moderator