Hi everyone,
I recently worked on integrating Salesforce REST APIs with OutSystems. In this post, I would like to share the approach I followed to authenticate with Salesforce and perform CRUD operations on the Salesforce Account object.
1. Integration Flow
The overall flow is:
The Access Token generated from Salesforce is then used in the Authorization header for the subsequent API calls.
2. Generate Salesforce Access Token
First, I created a REST API method in OutSystems for the Salesforce OAuth endpoint.
Method
Endpoint
Header
Request Body
The response contains the access token, which is stored in an OutSystems variable and used for the other Salesforce API calls.
For a real project, client credentials should not be hardcoded. They should be stored securely, for example using appropriate OutSystems configuration/secret management.
3. Authorization for Salesforce APIs
For the Account APIs, I used the access token generated in the previous step.
4. GET Account
For retrieving Account records, I created a REST API method using:
Example endpoint:
In OutSystems, AccountId is configured as an input parameter and passed to the REST API dynamically.
5. Create Account
To create an Account, I used the Salesforce Account endpoint:
In OutSystems, I created a structure representing the Account request and passed it as the request body.
The structure can contain fields such as:
Salesforce returns the newly created Account ID in the response.
6. Update Account
For updating an existing Account, I used:
Only the fields that need to be updated need to be included in the request.
7. Delete Account
For deleting an Account, I used:
Instead of hardcoding the Account ID, I configured it as an input parameter in OutSystems.
Server Action
I created a Server Action with:
No request body is required for the DELETE operation.
8. Suggested OutSystems Structure
I organized the Salesforce integration approximately like this:
The business logic can then call these REST methods through Server Actions.
For example:
9. Important Points
A few things that I found important during the integration:
Do not hardcode Salesforce Record IDs.Pass them as dynamic input parameters.
Use the correct Content-Type.
OAuth token request → application/x-www-form-urlencoded
Salesforce CRUD requests with JSON → application/json
Use the Access Token in the Authorization header:
For POST, use POST to create a record.
For PATCH, use PATCH to update an existing record.
For DELETE, use DELETE and pass the record ID in the URL.
Keep Salesforce credentials and secrets secure and avoid exposing them in client-side logic or source code.
10. Final Flow
The complete integration flow is:
This approach allowed me to perform Create, Read, Update, and Delete operations on Salesforce Account records from OutSystems using Salesforce REST APIs.
Hi,
Did you consider the built in SalesForce connection feature? What is the benefit of your solution compared to what ODC offers?
Regards,
Daniel
Hi @Daniël Kuhlmann ,
Thanks for your comment. This implementation was done in OutSystems 11. I shared it mainly for knowledge sharing, to demonstrate how Salesforce can be integrated with O11 using REST APIs and OAuth authentication.
I haven't compared this approach with the built-in Salesforce connection available in ODC, as the post was specifically focused on O11.
Regards, Anurag
Hi @Anurag Malviya
The point @Daniël Kuhlmann mentioned also applies only to O11, not ODC. In O11, we have Integration Builder, which allows us to connect with Salesforce with minimal effort.
I hope it will be helpful for you.
regards
Murali
A useful distinction here is the level of control you get with the custom REST approach. For O11 projects, especially where the Salesforce API calls need custom handling or only a small part of the Salesforce model is required, having the OAuth and endpoints exposed directly gives you more flexibility. The built-in connector would make more sense when the standard integration already covers the requirements and you want to reduce the amount of integration code to maintain.