Confluence has been updated to version 6.15.9

This article shows how to synchronize Servicenow fields of different types.

In Servicenow, you can get and set any of the fields of the entity by its internal name. For example:

  • get the state of an incident

    def state = incident.incident_state

  • set a value to the incident state field manually 

    incident.incident_state = "9"

Exalate maps the field names and values to the ServiceNow Rest API, which means that any field name/value that is allowed by the Rest API would work when used from the exalate groovy scripts.


ServiceNow to Jira

Source side(Servicenow)

Outgoing sync

Send a field value 

You should use the column name instead of the field.

 replica.short_description = incident.short_description

Destination side (Jira)

Incoming sync

Set the value received from the Servicenow to the Jira custom field

 issue.customFields."Jira Custom Field name".value = replica.short_description

Jira to ServiceNow 

Source side(Jira)

Outgoing sync

Send the Jira custom field value without any context to the Servicenow side

replica.customFields."Jira Custom Field name" = issue.customFields."Jira Custom Field name"

Destination side (ServiceNow)

Incoming sync

When setting received value from Jira custom field you need to know the type of the local field.

Fields of type String

Set the received value from the Jira custom field into the field of type String

You should use the column name instead of the field.

incident."short_description" = replica.customFields."Jira Custom Field name".value

Fields of type reference

To set the value received from the Jira custom field into the field of type reference you need to retrieve the field from ServiceNow API using getTableByName helper method. 

incident."assignment_group" = nodeHelper.getTableByName("assignment_group", replica.customFields."Jira Custom Field name".value)?.sys_id
in some cases, you are able to set a reference field by the display name value:
incident."assignment_group" = replica.customFields."Jira Custom Field name"?.value

ServiceNow to ServiceNow

Source side(ServiceNow)

Outgoing sync

Send a field 

You need to use the column name instead of the display name. Check how to find the column name of a ServiceNow field for more details.

replica.short_description = incident.short_description

Destination side (ServiceNow)

Incoming sync

Fields of type String

To synchronize an individual field of the same type

You should use the column name instead of the field.

incident.short_description = replica.short_description

You can set a value from one field to another field when creating the ServiceNow incident(or any other supported entity) use this example. It helps to append the string value to another field.

incident."Service Now Field Name" = "My value" + incident."Field 2 Name"