Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

CRM Custom Action Throwing an error

Posted on by 395

Hi,

I have created a custom action to share with other clients who will create and update the contacts in CRM online. I have created a custom action to share but when i tried to access any action in browser or soap ui i am getting the error. Here are the things i have done. I tried other actions as well. I am not trying to pass any reocrd id or some thing. Trying to setup in SoapUI to make sure my Request and response works fine.

1. Created a custom action and activated it.

2. Able to see the action definition and all the required details in metadata. Typed the below URL in browser and verified metadata. I am able to see the action that i created. Two input parameters and one output parameter.

https://********.api.crm.dynamics.com/api/data/v9.1/$metadata

3. Trying to test the action from SoapUI, I want to make sure this works fine before i share this with other clients. I am getting below error when i type in browser or try create a project in SoapUI to test request and response.

{"error":{"code":"0x8006088a","message":"The request URI is not valid. Since the segment 'contacts' refers to a collection, this must be the last segment in the request URI or it must be followed by an function or action that can be bound to it otherwise all intermediate segments must refer to a single resource.","innererror":{"message":"The request URI is not valid. Since the segment 'contacts' refers to a collection, this must be the last segment in the request URI or it must be followed by an function or action that can be bound to it otherwise all intermediate segments must refer to a single resource.","type":"Microsoft.OData.ODataException","stacktrace":" at Microsoft.OData.UriParser.ODataPathParser.CreateDynamicPathSegment(ODataPathSegment previous, String identifier, String parenthesisExpression)\r\n at Microsoft.OData.UriParser.ODataPathParser.CreateNextSegment(String text)\r\n at Microsoft.OData.UriParser.ODataPathParser.ParsePath(ICollection`1 segments)\r\n at Microsoft.OData.UriParser.ODataPathFactory.BindPath(ICollection`1 segments, ODataUriParserConfiguration configuration)\r\n at Microsoft.OData.UriParser.ODataUriParser.Initialize()\r\n at System.Web.OData.Routing.DefaultODataPathHandler.Parse(String serviceRoot, String odataPath, IServiceProvider requestContainer, Boolean template)\r\n at System.Web.OData.Routing.DefaultODataPathHandler.Parse(String serviceRoot, String odataPath, IServiceProvider requestContainer)\r\n at Microsoft.Crm.Extensibility.ODataV4.Routing.CrmODataPathHandler.Parse(String serviceRoot, String odataPath, IServiceProvider requestContainer)"}}}

I tried with both the below URLS and ran into above error message. I believe i am calling this in a wrong way.


1. https://********.api.crm.dynamics.com/api/data/v9.1/new_testcontact

I read a post about Bound URLS so tried by adding Microsoft.Dynamics.CRM but no luck.
2. ltitechvsn.api.crm.dynamics.com/.../Microsoft.Dynamics.CRM.new_testcontact

*This post is locked for comments

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: CRM Custom Action Throwing an error

    Okay. I would still suggest to use the Rest builder tool and see if your action is working there first. That's the easiest way to isolate/ troubleshoot the issue. The tool will also give you the exact url to be called for the action.  

    There are few things which can help you with custom actions-

    1) If you create a custom action and then it somehow stores the name of the custom action in cache so if you later deleted it and recreate it,. it may cause some problem. So everytime when you create an action use a different name.

    2) If your custom action is using any parameters, ensure that you do not mix simple & complex type. here is a an existing bug (I think it is not yet resolved) due to which custom action will not work s expected.

    docs.microsoft.com/.../mt628816(v=crm.8)

    If you still face issues then you can share the screenshot of your custom action here to get some suggestions.

    Hope this helps.

  • Srini20 Profile Picture
    Srini20 395 on at
    RE: CRM Custom Action Throwing an error

    Hi Ravi. Thanks for the update. I need to share this with other applications that exist in our organization. I will be sharing one user id and password to them so that they can access this CRM Action using as an API.

    I followed the steps in this article dotnet-posts.blogspot.com/.../calling-dynamics-crm-2016-actions-using.html but couldn't figure out where the problem with my action. All the actions that exist in Metadata are failing probably i may be doing some thing wrong.

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: CRM Custom Action Throwing an error

    Hi,

    I am assuming you are not sharing this to external client who doesn't have access to CRM. As in this case you need to register an app for authentication.

    For internal users, you could use the CRM Rest builder tool to test your custom action. This is the easiest way to build the query as well as execute it and see the results.

    carldesouza.com/dynamics-crm-rest-builder

    You can download the tool here- github.com/.../releases

    For SOAP UI, you can refer this blog if not already-dotnet-posts.blogspot.com/.../calling-dynamics-crm-2016-actions-using.html

    Hope this helps.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans