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
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!!
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
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.
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.
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??
Thank you Rawish for a quick response. Yes, I don't want any fields in the context to get updated.
which is your exact requirement?
Ancy,
Do you not want this to completely be update/saved or you want specific fields to not update?
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156