Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

finding which parent entity triggered child entity create plugin ?

(0) ShareShare
ReportReport
Posted on by 235

I have three entities:

  1. Employer
  2. Employee
  3. Benefits

Benefit is child entity for Employer and Employee entities. It means both of these can cause creating a Benefit record and I m writing a plugin (which will run on Create of Benefit). Question is how in code I can check which entity among Employer and Employee causes creation of Benefit record ? I appreciate your help.

Edit:

Drew suggested a way to check value, I m curies is there a way like I can know in plugin code which entity basically initiated it or triggered this plugin. I mean without checking value a way to get that linked entity name. Thanks

*This post is locked for comments

  • umma Profile Picture
    umma 235 on at
    RE: finding which parent entity triggered child entity create plugin ?

    Thanks Drew, I have updated my question. Kindly advice.

  • Verified answer
    Drew Poggemann Profile Picture
    Drew Poggemann 9,079 on at
    RE: finding which parent entity triggered child entity create plugin ?

    Hi CRM User,

    The Benefits entity can only be in a parental relationship with a single entity (i.e. Employer or Employee) and the other would need to be a referential relationship.  Each of the two fields will be on the entity (Benefits) as a Lookup field to the appropriate entity.  You will be able to look at the one that is not null and the Benefits entity will be related to that one.

    Hope this helps.

    Thanks,

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans