Hi All,
On a delete operation, i want to prevent delete of record and inactive that record.
Any help would be appraicted.
Regards,
Shahbaaz
*This post is locked for comments
Create a real-time workflow that triggers on Delete and in this workflow call a child background workflow to change the status to inactive.
And then call the Stop Workflow with Cancelled state with message to say record cannot be deleted and it will be deactivated.
Hi Kokulan,
Didn't worked.
Hi Shahbaaz,
Try to do using real time workflow entity delete event , if the status is inactive , stop workflow with cancelled status.. I have just tested its working for me .
Thanks gautam for the reply, could you provide any screenshot of such workflow?
I have uploaded the screenshot , please have a look.
along with that, it should inactivated that record
for that i have created background child workflow, but it is not deactivating the record
@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)
Thanks rawish for the reply, from my understanding if you throw exception from plugin pre operation, it will also rollback all your change's.
Please correct me if i am wrong.
Hi,
why dont you remove the delete privilege from security role and educate your user to use deactivate button.
Sorry , I got your point now. There is two scenario for two status (Active and Inactive )so you can create two real time workflow .
First workflow look like below -
If Status equal Active
Update case to Inactive
In that case you will get same message that inactive record can not delete.
Second workflow will be look like above which I shared , stop deletion of inactive reocords.
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Community Member 2
HR-09070029-0 2
UllrSki 2