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 execution information in context.

(0) ShareShare
ReportReport
Posted on by 290

I have a plugin which is running on entity "X" and it updates records in another entity "Y" from N:N relationship. From the  entity "Y" another plugin is triggering on the same update.

Is there any way to get the triggering record ID of "X" from the plugin triggering from "Y" ?.

Thanks in advance.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Rawish Kumar Profile Picture
    13,758 on at

    Generally we use shared variable for these kind of information :

    msdn.microsoft.com/.../gg328579.aspx

    however in your case since plugin Y is triggering once X is done - not sure if this is possible.Give it a try.

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    Hello Jomy,

    This functionality will be execute as infinite loop  in that case you need to check depth and parentexecutioncontext to handle it. For more details you can refer -

    crmbusiness.wordpress.com/.../stopping-infinite-plugins-with-parameters-depth-and-parentcontext

    msdn.microsoft.com/.../microsoft.xrm.sdk.iexecutioncontext.depth.aspx

    If you are associating or dissociating records then you need to use secondary entity in plugin registration tool,

    arpitmscrmhunt.blogspot.in/.../significance-of-secondary-entity-in.html

    Hope this helps

  • Jomy Jose Profile Picture
    290 on at

    Rawish Kumar ,   Thank you so much for the instant response . I will try and will update you.

  • Shahbaaz Ansari Profile Picture
    6,211 on at

    Hi Jomy,

    You can create a field "X ID" on Y entity and when you update Y entity, update that X ID field with X entity ID.  

    And also SharedVariables is used to pass data from a pre-event registered plug-in to a post-event registered plug-in.

    Thanks,

    Shahbaaz

  • Suggested answer
    Rawish Kumar Profile Picture
    13,758 on at
    You can use - parentcontext.sharedvariable insteqd of context.sharedvariable.
  • Jomy Jose Profile Picture
    290 on at

    Rawish, i have tried but it is not working because , 2 different plugin is running from 2 different entities. I had a scenario like below,

    let’s say that we have a plugin that executes when an Account is updated and that this plugin updates associated Contacts. Let’s also say that we have another plugin that gets triggered when the Contact is updated, so we have a case where the Account update plugin triggers this Contact update plugin.(Account and Contact have N:N relation)

    So i need the account ID from the plugin triggering in the contact.

  • Jomy Jose Profile Picture
    290 on at

    Hi Shahbaaz, thanks for the response.

    I had a scenario like, in Y entity both direct update and update from 'X' entity are happening(for multiple fields). if it is from X entity i need some values from X entity to do some calc.

  • Shahbaaz Ansari Profile Picture
    6,211 on at

    create a field in Y entity to store X entity ID, update that field only if it trigger from X entity else it will be blank and in your Y entity Plugin you can check the condition If that field value exists,

    means it is from X entity and with the help of QueryExpression or Fetch XML your can retrieve value from X entity as you have X entity ID in custom field of Y entity...

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