Updating ServiceNow from Amplify

This page demonstrates how to auto-update ServiceNow ticket logs using Webhooks, with remote actions or workflows executed from Amplify.

Based on the configuration, the auto-update can happen when:

  • A remote action or workflow is triggered.

  • A remote action or workflow is completed.

The code samples on this page can also apply to ServiceNow interactions by:

Replacing external_source== "SNOW-Incident" with external_source== "SNOW-Interaction" in the webhook NQL condition.

Replacing/table/incident/ with /table/interactions/ in the webhook Resource field.

Configuring a connector credential for ServiceNow

From the connector credential configuration page:

  1. Choose the HTTPS option from the Protocol drop-down.

  2. Paste the instance URL root https://<instancename>.service-now.com/ into the URL address field.

https://XXXXXXXXXX.service-now.com/
  1. Choose the OAuth 2.0 - Client Credentials option from the Authorization drop-down

    • Fill in the Access token URL, Client ID, Client secret and Scope fields according to the connector credential documentation.

  2. Save the credential.

Configuring a webhook

The following sections detail two scenarios for updating ServiceNow. The procedure for each scenario is quite similar, involving identical steps but differing in the NQL condition and payload specific to the remote actions and workflows, and also depends on the given scenario.

Update ServiceNow when a remote action or workflow is triggered

Configure a webhook in Nexthink that automatically updates incident ticket logs in ServiceNow when a remote action or workflow is triggered.

Remember to first set up a connector credential for the webhook.

  1. From the webhook configuration page, insert the NQL condition below. Refer to the Configuring webhook NQL conditions documentation for more examples.

NQL condition for remote action

NQL condition for workflow

  1. Select the connector credential you had previously set up for this webhook.

  2. Select the PATCH option from the Method drop-down.

  3. Insert the following API in the Resource field.

Resource API for remote action

Resource API for workflow

The {{remote_action.execution.external_reference}} and {{workflow.execution.external_reference}} are placeholders automatically filled with the ServiceNow ticket reference when the remote action or workflow is triggered from the Amplify extension.

Refer to the F.A.Q section at the bottom of this page for more information.

  1. Insert Payload, use the following messages example:

Payload for remote action

Payload for workflow

  1. For first-time configurations, Save webhook without testing and refer to the Amplify documentation to run a remote action or workflow from Amplify in ServiceNow and check if the webhook works properly.

    • Send test does not successfully test the webhook until you trigger a remote action or workflow from Amplify in ServiceNow to create the incident reference value for the Resource placeholder {{....}}.

    • Refer to the F.A.Q section to manually retrieve the incident remote_action.execution.external_reference or workflow.execution.external_reference value from ServiceNow and test the webhook configuration.

Refer to the Amplify installation and configuration guide to learn about configuring Amplify to integrate Nexthink instances with web applications, and deploying the configuration details via Registry.

Update ServiceNow when a remote action or workflow is completed

Configure in Nexthink a webhook that automatically updates incident ticket logs in ServiceNow with the result details of a completed remote action or workflow.

Remember to first set up a connector credential for the webhook.

  1. From the webhook configuration page, insert the NQL condition below. Refer to the Configuring webhook NQL conditions documentation for more examples.

NQL condition for remote action

NQL condition for workflow

  1. Select the connector credential you had previously set up for this webhook.

  2. Select the PATCH option from the Method drop-down.

  3. Insert the following API in the Resource field.

Resource API for remote action

Resource API for workflow

The {{remote_action.execution.external_reference}} and {{workflow.execution.external_reference}} are placeholders automatically filled with the ServiceNow ticket reference when the remote action or workflow is triggered from the Amplify extension.

Refer to the F.A.Q section at the bottom of this page for more information.

  1. Insert Payload, use the following message example:

Payload for remote action
@{ "work_notes": "Status of Remote action {{remote_action.remote_action.name}} triggered for this ticket from Amplify user {{remote_action.execution.account_name}} is as follows. Request time: {{remote_action.execution.request_time}} Execution time: {{remote_action.execution.time}} Status: {{remote_action.execution.status}} Status details: {{remote_action.execution.status_details}} Inputs: {{remote_action.execution.inputs}} Outputs: {{remote_action.execution.outputs.as(format=text)}}”}

Include the as(format = text) function in "work_notes" to display the output of a remote action in a readable format.

Payload for workflow
{ "work_notes": "Status of Workflow {{workflow.workflow.name}} triggered for this ticket from Amplify is as follows. Request time: {{workflow.execution.request_time}} Execution time: {{workflow.execution.time}} Status: {{workflow.execution.status}} Status details: {{workflow.execution.status_details}} Inputs: {{workflow.execution.inputs}} Outcome: {{workflow.execution.outcome"}}} 

  1. For first-time configurations, Save webhook without testing and refer to the Amplify documentation to run a remote action in Amplify from ServiceNow and check if the webhook works properly:

    • Send test does not successfully test the webhook until you trigger a remote action from Amplify in ServiceNow to create the incident reference value for the Resource placeholder {{...}}.

    • Refer to the F.A.Q section to manually retrieve the incident remote_action.execution.external_reference or workflow.execution.external_reference value from ServiceNow and test the webhook configuration.

Refer to the Amplify installation and configuration guide to learn about configuring Amplify to integrate Nexthink instances with web applications, and deploying the configuration details via Registry.


F.A.Q

How do I check if Amplify updates the incident or interaction log in ServiceNow?

The Amplify documentation explains how to register remote actions and workflows in the ServiceNow log using the Amplify extension. That is, after following the webhook configuration described on this page.

What is the value of the {{remote_action.execution.external_reference}} and {{workflow.execution.external_reference}}placeholders in the Resource field?

The process behind the Amplify webhook consists of Amplify obtaining the external_reference value from the ServiceNow URL by reading a set of predefined ServiceNow URLs and matching to find the ticket sys_id and type (incident or interaction).

Then, Amplify sends this external_reference value along with the remote_action or workflow information to the Nexthink platform, and the webhook uses these values to replace the webhook Resource placeholder, e.g., {{remote_action.execution.external_reference}}.

How do I manually retrieve the ServiceNow remote_action.execution.external_reference value to test the webhook configuration?

After running a remote action in Amplify from the ServiceNow browser page:

  1. Get the external_reference from the ServiceNow incident or interaction URL.

  • URL example in workspace view:

  • URL example in classic view:

From the Nexthink webhook configuration page:

  1. Replace the Resource placeholder {{remote_action.execution.external_reference}} with the manually retrieved external_reference from the ServiceNow URL. For example:

api/now/v1/table/incident/32dd789083xxxxxxxxxxxxxxxxxxxxx
  1. Send a test to check the webhook configuration. After confirming the test is successful, replace the Resource with the correct placeholder and Save webhook:

api/now/v1/table/incident/{{remote_action.execution.external_reference}}

How do I see the ServiceNow incident or interaction sys_id in the Nexthink platform?

After following the webhook configuration described on this page and executing a remote action using the Amplify extension in ServiceNow, run the corresponding NQL query from the Investigations page in Nexthink to get the ticket sys_id.

Find the sys_id under External reference and the ticket type under External source (external_source== "SNOW-Incident" or external_source== "SNOW-Interaction").


RELATED TOPICS

Last updated