- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2024 06:11 AM
When I am creating an incident in one instance, I want to check current caller id with another instance Incidents if there exist an even one incident. the current incident should not be created and should show pop up. for that I am trying to get the incidents data by passing caller id value.
but somehow I am messing up with something which I am not able to figure out can someone help me out to figure out what is happening, and modifications need to be done?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2024 06:19 AM
@KM SN Can you check if your query parameter name is correct? Can you call the same API via browser?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2024 06:43 AM
Hi Mmani,
On the Incident form, we have a related list of "Incident by same Caller"
If you want to get into REST API, write Scripted REST API.
Let me know if you need help writing REST API.
I am giving you a code that you can use in Your REST API.
var grIncident = new GlideRecord('incident');
grIncident.addEncodedQuery("caller_id=77ad8176731313005754660c4cf6a7de");
grIncident.orderByDesc('number');
grIncident.setLimit(20);
grIncident.query();
while (grIncident.next()) {
gs.info('number: ' + grIncident.getValue('number'));
gs.info('opened_at: ' + grIncident.getValue('opened_at'));
gs.info('short_description: ' + grIncident.getValue('short_description'));
gs.info('caller_id: ' + grIncident.getValue('caller_id'));
}
OR
You can user OOB REST API on incident tale
https://<instance_name>.service-now.com/api/now/table/incident?sysparm_query=caller_id.email=john.doe@example.com
For more detail about REST API Explorer
Thanks,
Sanjeev Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2024 09:42 AM
Actually I am writing REST message, is that not the way to get the incidents from 3 rd. party?