web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Plugin is not triggering for Associate Message using WebApi Client side request

(0) ShareShare
ReportReport
Posted on by

Hi
 I'm using D365 online CRM and on premise.
I wrote a plugin step for 'Associate'. When I'm adding records to subgrid, the custom exception is triggered in my code. But when i'm trying to call association using web api, the custom exception is not triggering. As i noticed that in Fiddler adding to subgrid the xml request is forming like below.

https://****.crm8.dynamics.com/AppWebServices/AssociateRecords.asmx

the request is showing error 500 for custom exception.

1856.error1.PNG

<?xml version="1.0" encoding="utf-8" ?><soap:Envelope xmlns:soap="schemas.xmlsoap.org/.../envelope" xmlns:xsi="www.w3.org/.../XMLSchema-instance" xmlns:xsd="www.w3.org/.../XMLSchema"><soap:Body><Associate xmlns="schemas.microsoft.com/.../WebServices"><subType></subType><objectType>8</objectType><parentObjectType>10084</parentObjectType><objectId>&#123;XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&#125;</objectId><parentId>&#123;XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&#125;</parentId><associationName>gr_gr_sysconfigurations_systemuser</associationName></Associate></soap:Body></soap:Envelope>

The response of exception:1856.error2.PNG

And the web api request is forming like below.

https://****.crm8.dynamics.com/api/data/v8.0/gr_sysconfigurationses(XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX)/gr_gr_sysconfig_systemuser_useraccess/$ref

the sucess response is showing for association using webapi shown below:

64483.error3.PNG
{"@odata.id":"https://****.crm8.dynamics.com/api/data/v8.0/systemusers(XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX)"}

Can any one have idea on this issue?.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Guido Preite Profile Picture
    54,086 Moderator on at

    looks like the plugin you wrote is throwing an exception, so you need to debug the plugin

  • Suggested answer
    Emre GULCAN Profile Picture
    2,379 on at

    Hi,

    If you use "InvalidPluginExecutionException" for throwing exception from your plugin, probably WebAPI recognize this "http 500" because of its description.

    Http 500 (https://httpstatuses.com/500) is internal server error and occurs when your code not working correctly, due to your screen shot you can use "description" property for details ("My exception").

    You should parse response or use try/catch to get exception or directly use Ajax "error".

  • Community Member Profile Picture
    on at

    In above scenario... http 204(https://httpstatuses.com/204) for success.. and it is adding to grid without exception in webapi association request

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi ibrahim,

    you could try to throw the following exception from the plugin:

    throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.NotFound,
    "ERROR DESCRIPTION")); 

    Refer to https://httpstatuses.com/ for HttpStatusCode list.

    Please let me know if you solve.

    If you found the answer helpful, please mark as Verified 

    Join my network on LinkedIn      Follow me on Twitter 

    Thank You & Best Regards

    Francesco Picchi

    Microsoft Dynamics CRM Consultant, Bologna+Milano, ITALY

    Independent Contractor

    http://www.francescopicchi.com

  • Community Member Profile Picture
    on at

    Hi Francesco,

    Here the main problem is plugin is not triggering. I just gave example for plugin is triggering with custom exception.

  • Community Member Profile Picture
    on at

    Stop suggesting nonsense to OP, it has nothing to do with exceptions. WEB API is still buggy, unfinished and this is one scenario where it does not work as intended. Associate through WEB API does not trigger custom logic registered on associate message. I encountered the same scenario. Probably the implementation is manipulating with with sql directly somehow? In any case will take months/years before issue this specific is fixed if ever.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans