Development

Why my action is not available through WebApi?

Recently I was working on task where I wanted to use Actions through JavaScript. It was a pretty usual task until I came calling of an action through WebApi. I was able to call that action through SOAP endpoint but every call through WebApi threw an error with message “Resource not found for the segment ‘new_MyAction’.

My action had couple of simple (strings and integers) input parameters and had to return one string and one EntityCollection in result. To make action available through WebApi I had to remove all outputs except EntityCollection.

Let’s separate all types of arguments into two groups – simple (boolean, datetime, decimal, float, integer, money, picklist, string) and complex (EntityReference, Entity, EntityCollection). You can have any combination of simple output parameters or single complex output parameter to make your action available for WebApi. In other words if you combine complex output parameter with any other one (including another complex output parameter) your action becomes unavailable for WebApi calls.

To check availability of your action you can use metadata url:

CRM Online –  https://yourorgname.crm.dynamics.com/api/data/v8.1/$metadata

On-Premise with IFD configured – https://yourorgname.yourdomain.com/api/data/v8.1/$metadata

On-Premise without IFD configured – http://yourcrmserver/yourorgname/api/data/v8.1/$metadata

Just open metadata url in browser, wait till page is loaded and hit Ctrl-F to find action you want to check:

ActionAvailability

3 Comments on “Why my action is not available through WebApi?

    1. Hello Pavel,
      I have not. May be it’s a good idea to post it to CRMIdeas portal. I was able to find a workaround – I just added all additional information I need as a last element of collection and it worked fine.

Leave a Reply

Your email address will not be published. Required fields are marked *