0

Before deleting the record (Ex: Account obj record), I want to update the field on the account record and send it to content management, hold it for a few seconds, and then delete it.

For this scenario, I used beforedelete event and updated the fields in the record, and called the content management with updated record data. The record is updated with new values (i verified after restoring it from recycle bin), But it is not calling the content management before deleting the record. Is there any option that we can wait for a few seconds until the record is updated on content management and delete the record? Please share your suggestions. Thank you.

1 Answer 1

0

If you let beforeDelete pass through without throwing error, Salesforce will delete the record immediately and put into recycle bin.

Since triggers cannot make callouts, you will have to notify Content management via async process (Queueable or Future) and async process is not guaranteed to execute in certain time. If you have lots of async jobs scheduled, Salesforce may delay execution of this particular async request to later time.

Instead of trying to time it, reliable approach is to pass the record id to Content Management system and indicate that it is deleted. Content mgmt can query the record with /queryAll api which returns deleted record with full details and take care of its process.

If you don't have control over having Content system make queryAll, you will have to do your own delete mark (with custom field), make a call and after a while delete the record.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.