Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Custom Field Mapping from Pagerduty to servicenow

zee15
Tera Contributor

Hi,

We integrate pagerduty with ServiceNow. I have created a custom field in pagerduty & I have a custom field on incident form as well now I want to map that field with the incident field in ServiceNow. I have follow the steps which is written in the document.

Document Link : https://support.pagerduty.com/docs/advanced-servicenow-configuration#custom-field-mappings

as they mention the steps that "

  1. Navigate to Custom Field Mappings.
  2. Select New from the top right.
  3. Select a ServiceNow field (Required): Select your preferred ServiceNow field from the dropdown. We will only fetch ServiceNow fields that match the approved field types.
  4. Enter the following under Configure the new PagerDuty field:
    1. Display Name: Enter a display name for the PagerDuty incident UI.
    2. Field Name: Enter a field name.
    3. Description (Optional😞 Enter an optional description.
  5. Review the mapping and then click Save.

In service now there no such kind of module "Custom Field Mappings".  

How can I map the custom field with ServiceNow.

 

 

10 REPLIES 10

Hi @zee15 , could you share an example of the dot walking you used on the Inbound Field Rule?
I was trying something like custom_fields.'name_of_the_custom_field' but it didn't work for me.

Thanks in advance!

Hi @Gon_alo Oliveir You can take a reference from this Snapshot which I attached below :

zee15_2-1733395798207.png

And in script field you can add this code :

 

var parsedData = value.details;
var result = "";
var description = "";

if (typeof parsedData == "string") {
    result = parsedData;
} else if (parsedData !== null && typeof parsedData === "object") {

    for (var key in parsedData) {
        description += key + " : " + parsedData[key] + "\n";
    }
    result = description;
}

 

 

 

Change the condition accordingly

 

Also you can take a reference from pagerduty doc : https://developer.pagerduty.com/docs/88922dc5e1ad1-overview-v2-webhooks

 

If this information was helpful, please mark this answer as Accepted as Solution and hit the helpful button. Thank you!

Thank you for the fast reply @zee15 !
I was able to get the custom field value using: "data.custom_fields.value".
Maybe this only works because I only have a custom field defined.
I will also take a look at what you mentioned!
Thank you once again!

If there is more than one custom field, it only seems to return the first instance of "data.custom_fields.value". Are you only bringing back one custom_field value, or have you attempted multiple yet?

Figured multiple custom fields out. If you set the value of PagerDuty webhook payload field to "data.custom_fields" then it returns the objects in the value. From there you can search through for the value related to the name of the custom_field

for (var i = 0; i < value.length; i++){
var fieldName = value[i].name;
var fieldValue = value[i].value;
}