Search code examples
jsondynamics-crmdynamics-365

OData Custom Action Response Restrictions


We have to talk to a Microsoft Dynamics 365 Api. When calling an custom action we retrieve a json as in the example below

{
    "@odata.context": "just-a-domain",
    "ids": "[{\"account\":\"whatever_id\",\"name\":\"test 2\"}]"
}

As you see the value of ids comes as string, but it should be json. Is there any restrictions for the return values in Dynamics 365?

The expected output should be like

{
    "@odata.context": "just-a-domain",
    "ids": [
        {
             "account": "whatever_id",
             "name": "test 2"
        }
    ]
}

Didn't find anything about it in the documentation. But the guy who's implementing the custom actions claims it is not possible to do it in any other way.


Solution

  • These are the data types supported in Custom action output parameter:

    enter image description here

    That being said, JSON is not the straight supported Output param type, but you can ask your CRM developer to give you back some fixed format anyway.

    Simply serialized JSON in String Output type, EntityCollection Or Entity types may help you if I understand your need correctly. Read more