- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 02-19-2025 02:36 PM
🚀 Integrating ServiceNow with Salesforce using REST API and OAuth 2.0
🌟 Are you working with both ServiceNow and Salesforce? Integrating these two platforms can streamline your processes and boost efficiency. Here's a step-by-step guide to help you integrate ServiceNow with Salesforce using REST API and OAuth 2.0 authentication. 💼
🔍 1. Understanding the Integration Flow
Before diving into the technical steps, let’s quickly take a look at the flow diagram. The process begins when an incident is created in ServiceNow, triggering a call to Salesforce using REST API and OAuth 2.0 authentication. Once authenticated, ServiceNow sends a POST request to Salesforce to create a case. Salesforce responds with a Case ID, which is then updated back into the ServiceNow incident record. This ensures both systems stay in sync, with accurate updates. 🔄
🔧 2. Creating a Connected App in Salesforce
Create a Connected App in Salesforce to allow authentication via OAuth 2.0:
- Navigate to Setup in Salesforce.
- In the search bar, type “App Manager”.
- Click on App Manager, then New Connected App.
- Name the app and enable OAuth settings.
- Under OAuth Scopes, select permissions like Full access or API access.
Salesforce will generate a Client ID and Client Secret, which we will use to authenticate ServiceNow. 🔑
🔒 3. Setting Up OAuth in ServiceNow
Set up OAuth 2.0 authentication in ServiceNow:
- Go to Application Registry in ServiceNow.
- Click New, then select Connect to an OAuth Provider.
- Choose Salesforce from the list of providers or create a custom one.
- Enter the Client ID and Client Secret from the Salesforce Connected App.
- Set the OAuth endpoint for Salesforce, typically https://login.salesforce.com/services/oauth2/token
🌐 4. Creating an Outbound REST Message in ServiceNow
Create an Outbound REST Message in ServiceNow to send the POST request to Salesforce when an incident is created:
- Navigate to Outbound REST Messages in ServiceNow.
- Create a new REST Message and provide the Salesforce API endpoint for creating a case (e.g., https://your_instance.salesforce.com/services/data/vXX.0/sobjects/Case/).
- Under HTTP Methods, select POST.
- Add necessary headers, including the Accept: application/json and the Content-Type as application/json.
- Add the data you want to send in the Body section, like the incident’s description, priority, and status.
🧪 5. Testing the Outbound REST Message and get the OAuth Token
Test the Outbound REST Message to ensure everything works correctly:
- Go to the REST Message you created and get the OAuth Token by clicking on Get OAuth Token button by entering the Salesforce username and password and click Test.
- If everything is set up correctly, you should receive a success response from Salesforce, including the Case ID.
🛠️ 6. Automating with a Business Rule
Automate the process so that a case is automatically created when an incident is created in ServiceNow:
- Create a Business Rule in ServiceNow that triggers on Incident creation.
- Call the Outbound REST Message in the Business Rule to send the incident data to Salesforce and create the case.
- Capture the Case ID from the response and update the Incident record with this ID.
✅ 7. Testing the Integration
Test the integration:
- Create an incident in ServiceNow.
- The Business Rule will trigger, calling the REST Message to Salesforce.
- Salesforce will create a case and return the Case ID.
- The incident record in ServiceNow will be updated with the Salesforce Case ID in the Correlation ID field.
🎉 Conclusion
By following these steps, you've successfully integrated ServiceNow with Salesforce using REST API and OAuth 2.0. This integration helps ensure incidents in ServiceNow are automatically converted to cases in Salesforce, reducing manual work and improving efficiency. 🔗
For more details, check out the API documentation linked below. If you have any questions, feel free to reach out in the comments!
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_create.htm
Also, please check out my YouTube channel for a detailed walkthrough of this integration process:
https://www.youtube.com/watch?v=zm2R2avtezQ
If you believe the solution provided has adequately addressed your query, could you please **mark it as 'Helpful'**. This will help other community members who might have the same question find the answer more easily.
Thank you for your consideration.
- 5,395 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
This was really helpful, can you please also create artical/video for inbound part.
When case is created in salesforce how to trigger incident/request(item) in servicenow using salesforce spoke.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
"I believe the request was exactly what I want to achieve in my current project: 'When a case is created in Salesforce, how to trigger an incident/request (item) in ServiceNow using Salesforce Spoke.'
Do you have any videos demonstrating how to implement this? I'd appreciate it if you could share them with me!"
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Worked great. Thank you. When getting the token we encountered some issues. We received a general authorization error which was fixed by adding an authorization URL even though it isn't required. Then we got the error 'error=redirect_uri_mismatch&error_description=redirect_uri%20must%20match%20configuration' which required us to change the redirect URL to the base URL we used when creating the client ID and secret. After that we were able authenticate.