Prevent delete of Record – Microsoft Dynamics CRM Forum Community Forum

0
33
Forum Post: Change the Filter On option on Opportunity Associated View for Account form


@Kokulan – it looks like as soon as we stop the workflow with error -it rollback everything or stop the trnsaction. Hence the record will not be update to inactivate.

I have tried to make the child workflow as background to deactivate the record but it doesnt work.

@Shahbaaz. I think you need to use a simple plugin.  

register your plugin pre-operation of delete

and check if status =active

{

update the status to inactive

service.Execute(new SetStateRequest

{

   EntityMoniker = new EntityReference(“contact”, contactId),

   State = new OptionSetValue(1),

   Status = new OptionSetValue(-1)

});

then throw invalidpluginexecutionexception which will stop the  deletion.

}

docs.microsoft.com/…/gg308277(v%3Dcrm.8)    



Source link

Leave a reply

Please enter your comment!
Please enter your name here