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
CUAdminCUAdmin 

Passing on IDs to an external web service from salesforce triggers

Hello: I am a newbie in dev forum and would appreciate some guidance in automating something for our organization. We need to store a list of salesforce object ids in our native sql server database. Thinking of this approach below:
- Create a trigger upon record deletions to pass on the deleted record ID to a web service hosted at our production platform
- The web service will take the id and save in our sql db

Question #1: Is there a better approach to automate our needs? If so please advise.

Question #2: If the web service based approach above is a good one too then in that case kindly give me some guidance on how to proceed. I know the basics of the trigger but not sure about the syntax of a web service call, specially does the web service need to be created WSDL etc.?

Thanks very much in advance.
Shashank SrivatsavayaShashank Srivatsavaya
Hi,

1.) A better approach would be to use the data replication feature provided by the Salesforce SOAP API, using the getDeleted() call. You can find more details here: https://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_getdeleted.htm

2.) If you want to go the trigger way, this page will help you with writing your web service callout class which can be invoked by triggers: https://developer.salesforce.com/page/Apex_Web_Services_and_Callouts

If this answers your question, please mark this as the Best Answer for this post, so that others can benefit from this post.

Thanks,
Shashank
CUAdminCUAdmin
Thanks so very much for the prompt reply. I will definitely explore the SOAP API approach then. thanks a bunch again, appreciate it.
ShashForceShashForce
Hi,

1.) A better approach would be to use the data replication feature provided by the Salesforce SOAP API, using the getDeleted() call. You can find more details here: https://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_getdeleted.htm

2.) If you want to go the trigger way, this page will help you with writing your web service callout class which can be invoked by triggers: https://developer.salesforce.com/page/Apex_Web_Services_and_Callouts

If this answers your question, please mark this as the Best Answer for this post, so that others can benefit from this post.

Thanks,
Shashank