- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2023 10:25 PM
How to make it so servicenow invokes a third party api the moment i submit an incident ticket. Like i fill in the incident ticket details on my developer instance and then the moment i hit submit. This data should be received by a third party API which would send a list of responses. And then those responses should show up on ServiceNow.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2023 11:15 AM
Use an outbound web service:
- https://docs.servicenow.com/bundle/vancouver-api-reference/page/integrate/outbound-web-services/conc...
- Or Depending upon the type of web service the 3rd party system supports
Or an make an outbound web service call with Flow Designer:
- https://docs.servicenow.com/bundle/vancouver-integrate-applications/page/administer/flow-designer/re...
- and here https://docs.servicenow.com/bundle/vancouver-build-workflows/page/administer/flow-designer/concept/f...
And then from the response received from doing either of those outbound requests contains the list of responses you're looking for you would parse through the response and save the necessary data to the place it needs to be within ServiceNow
You can also check out Chuck Tomasi's series Learn Integrations on the Now Platform
Playlist: https://www.youtube.com/watch?v=F9npfsOxOQk&list=PL3rNcyAiDYK0at2ypM6uhp_Mg6-gZlIdP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2023 11:20 AM
To set up ServiceNow to invoke a third-party API upon incident ticket submission and display the responses back in ServiceNow, you can follow these general steps:
1. **Create a Scripted REST API in ServiceNow:**
- Navigate to **System Web Services > Scripted REST APIs** in ServiceNow.
- Create a new API and define the endpoint URL, authentication, and request methods. You might need to write a script to process the incoming incident ticket data and invoke the third-party API.
2. **Invoke the Third-Party API:**
- In your Scripted REST API script, use scripting languages like JavaScript to format the incident data and make a request to the third-party API. You can use libraries like `GlideHTTPRequest` to make HTTP requests from your ServiceNow instance.
Example code (JavaScript):
```javascript
(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
// Extract incident data from the request object
var incidentData = request.body.data;
// Make a request to the third-party API
// Use GlideHTTPRequest or other HTTP libraries available in ServiceNow
// ...
// Process the response from the third-party API
// ...
// Return the response back to the caller
response.setContentType('application/json');
response.setBody(/* Your formatted response data */);
})(request, response);
```
3. **Configure Outbound REST Message:**
- Set up an Outbound REST Message in ServiceNow to define the third-party API endpoint, authentication details, and request format.
4. **Map Response Data to ServiceNow:**
- In your Scripted REST API, map the responses received from the third-party API to appropriate fields in ServiceNow incidents. Use the ServiceNow GlideRecord API to create or update records based on the third-party API responses.
Example code (JavaScript):
```javascript
var incident = new GlideRecord('incident');
incident.addQuery('number', 'INC123456'); // Use the appropriate incident number
incident.query();
if (incident.next()) {
// Map third-party API responses to incident fields
incident.setValue('field_name', thirdPartyApiResponse.fieldValue);
// Set other incident fields accordingly
// Update the incident record with mapped data
incident.update();
}
```
5. **Test the Integration:**
- Test the integration by creating an incident ticket in your ServiceNow developer instance. Ensure that the data is sent to the third-party API, responses are received, and mapped back to ServiceNow incidents correctly.
Please note that this process involves scripting and configuration specific to your ServiceNow instance and the third-party API you are integrating with.
Mark my response helpful & accepted if it helps you resolve your query.
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2023 11:15 AM
Use an outbound web service:
- https://docs.servicenow.com/bundle/vancouver-api-reference/page/integrate/outbound-web-services/conc...
- Or Depending upon the type of web service the 3rd party system supports
Or an make an outbound web service call with Flow Designer:
- https://docs.servicenow.com/bundle/vancouver-integrate-applications/page/administer/flow-designer/re...
- and here https://docs.servicenow.com/bundle/vancouver-build-workflows/page/administer/flow-designer/concept/f...
And then from the response received from doing either of those outbound requests contains the list of responses you're looking for you would parse through the response and save the necessary data to the place it needs to be within ServiceNow
You can also check out Chuck Tomasi's series Learn Integrations on the Now Platform
Playlist: https://www.youtube.com/watch?v=F9npfsOxOQk&list=PL3rNcyAiDYK0at2ypM6uhp_Mg6-gZlIdP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2023 11:20 AM
To set up ServiceNow to invoke a third-party API upon incident ticket submission and display the responses back in ServiceNow, you can follow these general steps:
1. **Create a Scripted REST API in ServiceNow:**
- Navigate to **System Web Services > Scripted REST APIs** in ServiceNow.
- Create a new API and define the endpoint URL, authentication, and request methods. You might need to write a script to process the incoming incident ticket data and invoke the third-party API.
2. **Invoke the Third-Party API:**
- In your Scripted REST API script, use scripting languages like JavaScript to format the incident data and make a request to the third-party API. You can use libraries like `GlideHTTPRequest` to make HTTP requests from your ServiceNow instance.
Example code (JavaScript):
```javascript
(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
// Extract incident data from the request object
var incidentData = request.body.data;
// Make a request to the third-party API
// Use GlideHTTPRequest or other HTTP libraries available in ServiceNow
// ...
// Process the response from the third-party API
// ...
// Return the response back to the caller
response.setContentType('application/json');
response.setBody(/* Your formatted response data */);
})(request, response);
```
3. **Configure Outbound REST Message:**
- Set up an Outbound REST Message in ServiceNow to define the third-party API endpoint, authentication details, and request format.
4. **Map Response Data to ServiceNow:**
- In your Scripted REST API, map the responses received from the third-party API to appropriate fields in ServiceNow incidents. Use the ServiceNow GlideRecord API to create or update records based on the third-party API responses.
Example code (JavaScript):
```javascript
var incident = new GlideRecord('incident');
incident.addQuery('number', 'INC123456'); // Use the appropriate incident number
incident.query();
if (incident.next()) {
// Map third-party API responses to incident fields
incident.setValue('field_name', thirdPartyApiResponse.fieldValue);
// Set other incident fields accordingly
// Update the incident record with mapped data
incident.update();
}
```
5. **Test the Integration:**
- Test the integration by creating an incident ticket in your ServiceNow developer instance. Ensure that the data is sent to the third-party API, responses are received, and mapped back to ServiceNow incidents correctly.
Please note that this process involves scripting and configuration specific to your ServiceNow instance and the third-party API you are integrating with.
Mark my response helpful & accepted if it helps you resolve your query.
Thanks,
Danish