function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ashley ZhaoAshley Zhao 

salesforce when delete a record how to trigger a process

hi,all.
i am new here .
i want to combine process bulider and flow to complete that when i delete a record  ,the process will be trigger..can everybody help me?
for example , the Account object,i want to delete an account's case, when i delete it,it will trigger an outbound msg...
thx....
Best Answer chosen by Ashley Zhao
Shashi PatowaryShashi Patowary
Hi Ashley,

Workflow does not execute when a record is deleted. Hence you cannot send an outbound message from workflow directly on case record deletion from account.
However, you can do a workaround -
1.Create a checkbox field in account e.g Delete_Flag__c
2.Create a trigger on Case object with 'before delete' event and update the related Delete_Flag__c in account rceord when a case is deleted
3.Create a workflow in Account object that has filter on Delete_Flag__c field and create your required outbound message


Please let me know if it works.

Regards,
Shashi

All Answers

Shashi PatowaryShashi Patowary
Hi Ashley,

Workflow does not execute when a record is deleted. Hence you cannot send an outbound message from workflow directly on case record deletion from account.
However, you can do a workaround -
1.Create a checkbox field in account e.g Delete_Flag__c
2.Create a trigger on Case object with 'before delete' event and update the related Delete_Flag__c in account rceord when a case is deleted
3.Create a workflow in Account object that has filter on Delete_Flag__c field and create your required outbound message


Please let me know if it works.

Regards,
Shashi
This was selected as the best answer
Neetu_BansalNeetu_Bansal
Hi Ashley,

Workflow Rules or Processes not execute when a record is deleted. So you can create a trigger for the same. Whenever any record deleted, send the outbound message from the trigger itself.

Let me know, if you need help in writing the trigger.

Thanks,
Neetu
Priti Deshmane 8Priti Deshmane 8
Hi Shashi,
 
I have same requirement where on opportunity record deletion i need to update the custom field on opportunity named as isdeleted__c and need to send this updated field to external system through outbound message. 
 
I have wriiten a trigger on before delete which is updating this field successfully 
 
Trigger fieldupdate on opportunity (before delete){
 
If(Trigger.isdelete){
 
List<Opportunity> deletelist= new List<Opportunity>();
For(Opportunity opp:[select Id from opportunity where Id in : Trigger.old){
Opp.isdeleted__c = True;
deletelist.add(opp);
}
Update deletelist;
}
}
 
I have created one flow on record update with filter criteria as isdeleted == true and added outbound message action as per your third step but this is not firing on field update... Can u please help me with this. Please correct me if i am going wrong somewhere?
 
If it has some alternative please provide me 

@neetu if this possible through trigger please share me the code to trigger outbound message