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 Microsoft Employee

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

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Plugin is not triggering for Associate Message using WebApi Client side request

    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.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Plugin is not triggering for Associate Message using WebApi Client side request

    Hi Francesco,

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

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Plugin is not triggering for Associate Message using WebApi Client side request

    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
    Community Member Microsoft Employee on at
    RE: Plugin is not triggering for Associate Message using WebApi Client side request

    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
    Emre GULCAN Profile Picture
    Emre GULCAN 2,379 on at
    RE: Plugin is not triggering for Associate Message using WebApi Client side request

    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".

  • Suggested answer
    Guido Preite Profile Picture
    Guido Preite 54,073 Moderator on at
    RE: Plugin is not triggering for Associate Message using WebApi Client side request

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

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans