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
Neil_SNeil_S 

Object Deletion - telling non-SF systems

Hi,

 

We use SalesForce to maintain Account and Contact details, and keep our other internal systems in sync by using Outbound Messages fired on create / modify.  These messages are monitored by an internal process to fetch the data out of SalesForce via the API and update internally.

 

The problem we have is that we want a delete in SalesForce to flag the record as deleted in our internal systems.

 

The issues we're hitting are:

Workflows aren't fired on delete (doesn't count as a modify?)

Can't manually trigger an Outbound Message, say in a before delete trigger (this is my assumption, please advise if wrong)

Even if we did manually trigger an OM, once the object is deleted, my testing shows it is removed from the OM queue if not already delivered (=> unreliable)

 

So, from what I can see we have a couple of options:

1) Allow delete, but have an additional, scheduled process that scans SF looking for records deleted in the last x hours / minutes and update internal systems.

2) Implement some sort of Approval process for deletes, requiring the setting of a non-SF delete flag to tell our internal systems, before allowing delete after manual confirmation of the internal update.

 

Both of these are quite clunky given the existing processing of creation / updates.  Has anyone been here before?  Got a neat solution?

 

Cheers,

Neil

 

Ritesh AswaneyRitesh Aswaney

You could

 

1) Have Soft Deletes (i.e. set a checkbox or such), where when a user 'deletes', you simply change the Owner of the record to a User with a Role outside / above the Role Hierarchy, so that it is not visible to anyone. Then have a scheduled batch process which scans for these 'deleted' records, perform your processing of outbound messaging and then delete these records physcially.

 

2) Have a Before Delete Trigger, which constructs and sends an Outbound Message, not reliant on out-of-the-box salesforce outbound messaging. You could actually consume the external webservice wsdl - create proxy classes, and invoke this via the trigger to send the outbound notification. Of course, it would be easier if it was a REST endpoint you're trying to message, rather than SOAP

MunmunMunmun

Hi Niel,

 

can u share with us sample code.regarding deletion trigger:smileyhappy: