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
Smadar NirSmadar Nir 

APIs and integration issue

 I would like to know if there's a way to send a POST (or GET) HTTP request to a certain URL while a customer is created or updated in the Salesforce CRM.
I need to get the new customer's details, and create an account in a different system with those details, right after the user is created / updated in Salesforce. I want to do that by creating a PHP application that will get a POST request from Salesforce, and send an API request with the customer's details to the API of a different systemi.e. on every trigger of update / creation of a customer, Salesforce will send a POST request to a predefined URL
I saw that there's an option to use streaming API in Salesforce, but I couldn't find an option to send a POST / GET request with the customer's details right after creating / updating a customer in the Salesforce CRM.
It's also possible for us to only get the customer's ID, and our application will retrieve the rest of the customer's details by an API call to Salesforce.
Your help is appreciated.
 
 
Balaji Chowdary GarapatiBalaji Chowdary Garapati
Hi Smadar Nir,

Did you consider the option of outbound messaging in salesforce? Below is the url,

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_om_outboundmessaging_setting_up.htm

It is easy to setup and you can configure a work flow rule to send this outbound message upon creation of new customer with the data required. It sends a soap message though, which you might need to consider for the implementation. 

Using streaming API for this particular scenario wont be the ideal solution, as it requries a salesforce oAuth token to connect, in other words requries a dedicated login, and there are also limits on the streaming api usage. (too many resources to spare for a simple functionlaity).

Hope it helps.

Thanks,
Balaji
UC InnovationUC Innovation
Hi,

You can create an insert and update trigger on the customer record, and then use @future method to do a callout to the external system.  The link below talks about using the @future method:

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_future.htm

Hope that helps.


Thanks,

Ken