ServiceNow

Use the integration to streamline your incidents and respond to them automatically.

Overview

ServiceNow (often referred as SNOW) integration is intended for users who have ServiceNow set up as an IT Service Management/Ticket Management system.

A lot of IT teams or cloud teams use ServiceNow as a single pane of glass for their Incident Management.

With this integration, we have covered most of the incident related functionalities.

Use Cases

The integration between Fylamynt and ServiceNow lets you:

  • Ingest incidents as a trigger to Fylamynt workflows. (Fetch ServiceNow incidents into Fylamynt)

  • ServiceNow Search Incidents - Get incident list according to the supplied query.

  • ServiceNow Create Incident - Create a new ServiceNow Incident.

  • ServiceNow Update Incident - Update a specific ServiceNow Incident.

  • ServiceNow Delete Incident - Delete a specific ServiceNow Incident.

Configure ServiceNow in Fylamynt

  • Navigate to Settings > Integrations > ServiceNow

  • Click Add integration to create and configure a new integration instance.

Details needed to set up ServiceNow instance in Fylamynt:

Parameter

Description

Required

ServiceNow Instance URL

ServiceNow instance URL

True

ServiceNow User Password

Password for authorized user on ServiceNow instance

True

ServiceNow Username

Username for authorized user on ServiceNow instance

True

Webhook API Key Name

The Fylamynt API key to use for incoming ServiceNow webhooks.

False

ServiceNow Webhook URL

Fylamynt Webhook URL to be used by ServiceNow

True

Setting up ServiceNow integration

In order to integrate Fylamynt with ServiceNow, you first need to set up a role user on your ServiceNow instance.

  • Log in to your ServiceNow instance with an admin account.

  • Go to the users table and click "New".

  • Fill out the User ID, Email, First Name, Last Name, and Password fields.

  • Make sure "Active" is checked. Optionally, you can also check the "Web services access only" box.

  • Make sure "Password needs reset" and "Locked out" are unchecked.

  • Click "Submit".

On the Fylamynt side

  • Create an API Key to use for ServiceNow webhooks.

    • On Fylamynt Settings page, scroll to the bottom, and click "API Keys".

    • Click "Add New".

    • Enter a name for the API Key.

  • Return to Settings / ServiceNow.

  • Enter your ServiceNow instance's URL. For example: "https://dev12345.service-now.com".

  • Enter the username and password for the ServiceNow user you created earlier in the right hand sidebar.

  • Select the API Key you created in Fylamynt from the dropdown list of API keys.

  • Click "Authorize".

Setting up Webhook Trigger Action for ServiceNow

  1. In your ServiceNow instance navigate to Outbound->REST Message

  2. Click "New"

  3. Give the Outbound REST call a name and a short description.

  4. Copy the "Webhook URL" from the Fylamynt ServiceNow configuration and paste it into the "endpoint" field.

  5. Leave "Authentication" set to "No Authentication"

  6. Click "Submit".

  7. Find the REST Message you just created in the list and re-open it.

  8. There will be an "HTTP Methods" section that wasn't there before. Click "New" next to "HTTP Methods".

  9. Name it "POSTCall"

  10. Select "POST" from the HTTP method dropdown.

  11. In the "HTTP Request" tab, add the following to the headers:

    • x-api-key : copy the key value from the Fylamynt API Key you created above and paste in in the value.

    • accept : application/json

    • Content-Type : application/json

  12. In the "Content" text box, paste the following JSON (this is just an example, you may add more fields from the incident table as needed)

    {
    "sys_id":"${sys_id}",
    "number":"${number}",
    "short_description": "${short_description}",
    "urgency": "${urgency}",
    "description": "${description}",
    "impact": "${impact}",
    "state": "${state}",
    "instance_id":"${instance_id}"
    }
  13. Click "Submit".

  14. Re-open the HTTP Method you just created.

  15. In the "Related Links" list, click "Auto-generate variables"

  16. Click "Update".

  17. Navigate to "Business Rules".

  18. Click "New"

  19. For the new Business Rule, enter a name, select a table ('incident' is the default ServiceNow incident database table)

  20. Check "Active" and "Advanced"

  21. In the "Advanced" tab, enter the following JavaScript. (This is just an example. Feel free to edit this code to include/exclude whichever fields you require.)

    • Be sure to change 'YourOutboundRestCall' to the name you gave your outbound rest call above.

    • Also make sure the second argument to sn_ws.RESTMessageV2() is the name of the HTTP Method you created above.

      (function executeRule(current, previous /*null when async*/ ) {
      // Add your code here
      function jsonEncode(str) {
      str = new JSON().encode(str);
      return str.substring(1, str.length - 1);
      }
      try {
      var r = new sn_ws.RESTMessageV2('YourOutboundRestCall', 'POSTCall');
      r.setStringParameter("sys_id", current.sys_id);
      r.setStringParameter("number", current.number);
      r.setStringParameter("short_description", current.short_description);
      r.setStringParameter("urgency", current.urgency);
      r.setStringParameter("description", jsonEncode(current.description + ''));
      r.setStringParameter("impact", current.impact);
      r.setStringParameter("state", current.state);
      r.setStringParameter("instance_id", gs.getProperty("instance_name"));
      var response = r.execute();
      var responseBody = response.getBody();
      var httpStatus = response.getStatusCode();
      gs.log("getBody: " + response.getBody());
      gs.log("getStatusCode: " + response.getStatusCode());
      gs.log("getHeaders " + response.getHeaders());
      } catch (ex) {
      var message = ex.message;
      }
      })(current, previous);
  22. In the "When to run" tab, select "after" from the dropdown and check "insert".

  23. You can add other conditions as you see fit.

  24. Click "Submit"

Now when you create a new incident in the incident table, a call will be made to Fylamynt containing the JSON you provided in step 12 above, populated with the fields in the new incident.

To take action when this message is received, create a new Fylamynt workflow and add a ServiceNow_Alert action to it.

Integration Actions

Fylamynt supports the following ServiceNow actions in workflows:

1. Create ServiceNow Issue

Creates a new incident in ServiceNow

Input

Parameter Name

Required

table

True

short_description

True

caller

True

urgency

False

severity

False

assigned_to

False

caller_id

False

category

False

description

False

due_date

False

made_sla

False

incident_state

False

impact

False

number

False

priority

False

template

False

state

False

Output

Parameter name

Type

Description

Result

Object

JSON of the newly created incident.

2. Search ServiceNow Issues

Return the results of a ServiceNow query. Because the results might be very large, you can provide the name of an S3 bucket to save the non-truncated results.

See: Operators available for filters and queries

Input

Parameter Name

Description

Required

query

Query formatted per ServiceNow query syntax.

True

table

The ServiceNow table to run the query against.

True

s3_bucket

S3 bucket to save the full result list.

False

Output

Parameter name

Type

Description

result

JSON object

The output of the query.

is_result_truncated

Boolean

If the result is too large (>~100k) the results will be truncated to the first 5 incidents.

result_bucket_key

String

If an S3 bucket is specified, the path to the data.

s3_bucket

String

The bucket specified in the input.

3. Update ServiceNow Issue

Given an incident to update, update the provided fields.

Input

Parameter Name

Description

Required

table

The ServiceNow table to update.

True

sys_id The ID of the incident to update

True

short_description

String

False

urgency

False

severity

False

assigned_to

False

caller_id

False

category

False

description

False

due_date

False

made_sla

False

incident_state

False

number

False

priority

False

template

False

state

False

caller

False

Output

Parameter name

Type

Description

Parameter name

Type

Description

result

JSON Object

The updated incident

4. Delete ServiceNow Issue

Delete the specified incident.

Input

Parameter Name

Description

Required

table

The ServiceNow table to update

True

sys_id

The ID of the incident to update

True

Output

  • Delete doesn't return a result.

5. ServiceNow Alert

This snippet handles the outbound REST calls from ServiceNow.

Input

  • Input comes from the body of the Outbound REST call.

Output

  • Output JSON Object containing the outgoing call. Fields included will depend on the call set up in ServiceNow.