@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.
}