Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

How to delete all attributes in context of plugin?

Posted on by

I want to prevent the update on an entity. So I am planning to write plugin on pre-operation of that entity, where I want to remove all context attributes. so that it will not be updated. 

How can it be done?

Or.. is there any other way to prevent update on an entity?

Please help me...

*This post is locked for comments

  • Verified answer
    Ancy Profile Picture
    Ancy on at
    RE: How to delete all attributes in context of plugin?

    Thank you everyone for your replies.

    Finally I have taken an approach to write Pre and Post operation plugin on merge message of master entity.

    On Pre merge operation I have retrieved collection of all related entities and context data. Stored it in a shared variable. And finally used it in post merge operation to revert the changes done by OOB Merge.

    And it worked!!

  • Suggested answer
    tw0sh3ds Profile Picture
    tw0sh3ds 5,600 on at
    RE: How to delete all attributes in context of plugin?

    For some of the entitites you should be able to configure your relationship as Cascading and simply choose the Merge option to "None", but for some system relationships this is not possible and you will have to write plugin. If done properly you can have only one plugin, you will just have to register multiple plugin steps in Plugin Registration Tool

  • Ancy Profile Picture
    Ancy on at
    RE: How to delete all attributes in context of plugin?

    Yes Thank you. I have thought about it. But in the situation as I described above.. I will be having many related records. Because the child record can have any number of related activities and related records. So, how may plugins will I have to write is uncertain... and thus this approach is not feasible as far as I analysed.

    Please correct me if I am wrong.

    Thus I was looking for an approach to prevent it from the merge message of the entity itself.

  • Suggested answer
    tw0sh3ds Profile Picture
    tw0sh3ds 5,600 on at
    RE: How to delete all attributes in context of plugin?

    Just like I told you already in another question, you have to make a plugin for related entity (which parent entity will be updated during merge) not the merge operation itself. So let's say you have Account which you merge and want to prevent Contacts from being moved to the new Account. You create a plugin Pre-Update of contact which will fire on update of parentcustomerid field. In the plugin you simply check if this update comes from Merge operation (by checking the parent context) and if yes, you simply remove attribute parentcustomerid from Target.

  • Ancy Profile Picture
    Ancy on at
    RE: How to delete all attributes in context of plugin?

    Thank you Guido for a quick response.

    The requirement is:-

    The OOB Merge functionality of dynamic CRM is copying all the informations from child record  in the master record and is setting activities and related records of child record to master record.

    But I want  only the activities to get copied.

    So, I am thinking of clearing the context data in Merge pre-operation.

    Is the approach correct? Any suggestions??

  • Ancy Profile Picture
    Ancy on at
    RE: How to delete all attributes in context of plugin?

    Thank you Rawish for a quick response. Yes, I don't want any fields in the context to get updated.

  • Guido Preite Profile Picture
    Guido Preite 54,081 Super User 2024 Season 1 on at
    RE: How to delete all attributes in context of plugin?

    which is your exact requirement?

  • Suggested answer
    Rawish Kumar Profile Picture
    Rawish Kumar 13,756 on at
    RE: How to delete all attributes in context of plugin?

    Ancy,

    Do you not want this to completely be update/saved or you want specific fields to not update?

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans