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
krprkrpr 

Triggering outbound message on deleting or merging contact object.

I would like to able to merge Companies and Contacts on Salesforce regardless of whether or not the Companies and Contacts have been integrated to another system. 
When the records are merged I would like the other systems integrated to Salesforce to be notified. 
After the merge has completed the Id's of the record that has been updated will be sent from Salesforce to <External System> 
The Id's of the records that have been deleted as part of the merge process will also be sent to <External System>
I wanted to know if there is a way to trigger the outbound message when a contact is deleted. It seems that it does not trigger the outbound message when an existing contact is deleted or merged.
If yes could you please provide a working example.
Thnaks in advance
adi.sfdcproadi.sfdcpro

Hi,

 

I dont think you can do it through standard functionality. You have to write a trigger on "after delete" event of trigger and use Http classes to generate the required SOAP message through Apex. 

 

Hope it helps.

 

Adi.

RadnipRadnip

You could write a trigger on the object to do the outbound message on deletion.

 

EG:

 

 

if (Trigger.isDelete){

   // Code to do the outbound message

 

}

krprkrpr

Can you pls provide me the Code snippet for this please.

RadnipRadnip
trigger NameOfTrigger on theObject (before delete) {

  if (Trigger.isDelete){
     // Code to do the outbound message 
  }
}

 

What bit do you want help with? above is the outline for doing the trigger...

krprkrpr
Hi, I am confused of the outbound message code. I haven't done much on integration side. Can you please help me on this. Can you please provide me with code how to send outbound message. I am fine wih delete trigger. Thanks in advance Krpr
krprkrpr

Oh1 I was confused . Done now...

 

Anyways thanks for your time..

krprkrpr

Trigger and a Controller does this . cool

Rey RahadianRey Rahadian

hi @krpr, glad you have solved the problem. 

 

i know now from these thread that we can set trigger on contact delete action and then trigger the outbound message from inside the Apex trigger.

 

but how do exactly we trigger the outbound message, can you provide some code sample ?

 

that would help greatly, thanks.