- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2025 12:12 PM
I am working on Pagerduty integration, and I am trying to populate the incident fields using the "PagerDuty Inbound Field Rules". Payload has a bunch of data, just want to bring the CI name. I know JSON, but not sure to do that here.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2025 08:32 AM - edited 04-11-2025 08:34 AM
We have to use the following PagerDuty webhook payload field string: data.first_trigger_log_entry.channel.details.host to get the string data, and since the Configuration item is a reference we have to use the Script to try and find the object. If you set something like the below up in the script, save and test with the payload, you should see a sys_id returned as opposed to the string data.
//The string data comes back as "value"
var host = value;
var ci = findCI('cmdb_ci_server', 'fqdn', host);
if(!ci)
ci = findCI('cmdb_ci', 'name', host);
result = ci;
function findCI(qTbl, qFld, qVal){
var gr = new GlideRecord(qTbl);
gr.addQuery(qFld, qVal);
gr.setLimit(1);
if(gr.next()){
return gr;
}
return false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2025 08:32 AM - edited 04-11-2025 08:34 AM
We have to use the following PagerDuty webhook payload field string: data.first_trigger_log_entry.channel.details.host to get the string data, and since the Configuration item is a reference we have to use the Script to try and find the object. If you set something like the below up in the script, save and test with the payload, you should see a sys_id returned as opposed to the string data.
//The string data comes back as "value"
var host = value;
var ci = findCI('cmdb_ci_server', 'fqdn', host);
if(!ci)
ci = findCI('cmdb_ci', 'name', host);
result = ci;
function findCI(qTbl, qFld, qVal){
var gr = new GlideRecord(qTbl);
gr.addQuery(qFld, qVal);
gr.setLimit(1);
if(gr.next()){
return gr;
}
return false;
}