Inbound Integration
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2024 04:00 AM - edited 10-01-2024 08:54 AM
Hello everyone,
I have a requirement where I have done integration with third party using rest message for change table which is working fine .
After build stage the change is created in third party and now when it moves to test , it will perform testing in 3rd party and once done 3rd party will send flag to ServiceNow ,so how we do inbound integration for patch method .
I am unable to understand what will be the triggering point , how will system understand that the flag has been sent from third party and then the workflow should move forward.
How do I achieve this using transform maps?
@Community Alums @Ankur Bawiskar Please help .
Can somebody help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2024 04:39 AM
Hi @harry24
In ServiceNow, you need to create a new REST API endpoint that the third-party system will call when it sends the status update.
Under your REST API, create a new Resource. Set the HTTP method to PATCH.
Define the Path for the resource, which will be called by the third-party system. For example, /api/your_api/change_status.
Use a Scripted REST API to handle the PATCH request. Under your Scripted REST API, create a new resource. Set the method to PATCH and provide a path. In the script section, implement the logic to handle the incoming request.
Have a look of sample script bellow and make changes as per your requirement:
(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
// Extract data from the incoming request
var changeId = request.queryParams.change_id; // Assuming you're sending a change_id in the query
var newStatus = request.body.status; // Assuming you're sending a status in the request body
// Check if change exists
var changeGr = new GlideRecord('change_request');
if (changeGr.get(changeId)) {
// Update the status or other fields as needed
changeGr.state = newStatus; // Set the new status
changeGr.update();
// Return a success response
response.setStatus(200);
response.setBody({
"message": "Change status updated successfully",
"change_id": changeId
});
} else {
// Return a not found response
response.setStatus(404);
response.setBody({
"message": "Change not found"
});
}
})(request, response);
i hope my answer helps you to resolve your issue, if yes please mark my answer helpful and correct.
thank you
rajesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2024 05:11 AM
what will be the triggering point for this patch request ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2024 05:33 AM
hi @harry24
The triggering point for a PATCH request in the context of your inbound integration with ServiceNow can vary based on your specific requirements and the third-party system’s behavior.
following are some common scenarios:
Status update event: The third-party system sends a PATCH request when a specific event occurs. This could be an internal flag or status change that indicates the completion of a task or a requirement.
Schedule job : A scheduled job in the third-party system could periodically check for changes and send a PATCH request to ServiceNow with the current status.
Manual triggering : A user in the third-party system manually triggers the PATCH request, for instance, through a button or interface once testing is complete.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2024 08:41 AM
How can I achieve this using import set ?