ServiceNow Pagerduty Inbound Rule

Hi,

I am looking to concatenate 2 field values in the payload ( incident.title + log_entries.channel.details.description) to add to Description field on Incident table. Can i know if inbound rule can be used to concatenate two field values and add to a target field.

You can certainly do this with an inbound field rule in our ServiceNow App.

Does something like the below screenshot work? Adding Incident.title and log_entries.channel.details.description fields together with a plus(+) sign. I guess the PagerDuty Webhook Payload field will only take one field.

PagerDuty.jpeg

No, you’d need to use a custom script (tick the Run lookup script box) in the IFR to extract the fields you want from the webhook and then return them using the + sign to concatenate them together.

Can you please help me with a sample script for this. Can i also know in that case, what should be added in the PagerDuty Webhook payload field?

Here’s something off the top of my head to get you started:

//value is the incoming webhook field selected in IFR
//result is the outgoing value to target field in IFR

gs.debug("in IFR001001....");

// extract the title value from webhook payload
var title = value.foo.bar.title;

// extract the description value from webhook payload
var description = value.foo.bar.description;

// create the concatenated variable
var newTitle = title + ' : ' + description;

gs.debug("the value for result will be: "+newTitle);

// return the new value to the target incident form field
result = newTitle;

@rishika.reddy - did this solution work for you? how did you solve it? I am also facing a similar issue where I need to update the subcategory of incident, based on the alert payload - Description field.