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
Sandesh Vishwakarma 9Sandesh Vishwakarma 9 

Hii Wonderful People , Today I am seeking help for one of my task that is followed as :

I want to send the Opportunity record ID to an external web server whenever the opportunity record is updated so that they can perform opertions on their database to update the same record there as well.

I have written a trigger to get the recordID of thr updated record. Now I want to send it to the external web server please help me out. Thank you


trigger GetUpdatedOpportunityID on Opportunity (before update) {
        Set<Id> allInsertedIds = trigger.newMap.keySet();
        system.debug('allInsertedIds--------------------------------' + allInsertedIds);

}
 
McCuboMcCubo
Hi Sandesh,
I think you would need to write an apex class to perform the callout to the external web server, take a look at this trailhead: Apex REST Callouts (https://trailhead.salesforce.com/en/content/learn/modules/apex_integration_services/apex_integration_rest_callouts)
Essentially what you need is to use the HttpRequest object, set its parameters (web server URL, HTTP method, and the payload (in your case the list of oppotunity Ids)).
One thing to take into account is callouts cannot be made in a Trigger context, so you might have to create an apex class to handle the web service request and the respose.