• Home
  • Integrations
  • SDKs
  • Guides
  • API docs
    No results for ""
    EXPAND ALL

    EDIT ON GITHUB

    Setting up the ServiceNow integration

    Read time: 4 minutes
    Last edited: Sep 02, 2022

    Overview

    This topic explains how to configure the LaunchDarkly ServiceNow integration for flag approvals.

    The ServiceNow approvals integration is an Enterprise feature

    The ServiceNow approvals integration is available to customers on an Enterprise plan. To learn more, read about our pricing. To upgrade your plan, contact Sales.

    Prerequisites

    In order to complete this topic, you must meet the following prerequisites:

    • You must have a LaunchDarkly account with a role that allows the integration/createIntegration role.
    • You must have an existing ServiceNow account with the admin role.
    • You must have a ServiceNow Client ID and secret for an OAuth API endpoint for external clients. To learn how to create these, read ServiceNow's documentation.

    Setting up the ServiceNow integration in LaunchDarkly

    To use the ServiceNow integration to perform flag approvals, you must first establish an OAuth connection between your LaunchDarkly and ServiceNow accounts. After you create the connection, you can either:

    To establish an OAuth connection:

    1. Log in to ServiceNow.
    2. Complete ServiceNow's instructions for creating an endpoint for external clients.
    3. Navigate to the LaunchDarkly Integrations page and find "ServiceNow."
    4. Click Add integration. The integration menu appears.
    5. Click Connect to ServiceNow. An OAuth provider registration dialog appears.
    6. Copy the Redirect URL to your clipboard.
    LaunchDarkly's ServiceNow OAuth provider registration form.
    LaunchDarkly's ServiceNow OAuth provider registration form.
    1. In ServiceNow, follow the directions to create an endpoint for external clients.
    2. Set the Redirect URL to the redirect URL saved to your clipboard in the previous step. Ensure you are following the directions for your ServiceNow version.
    The ServiceNow external client endpoint registration form with the Redirect URL configured.
    The ServiceNow external client endpoint registration form with the Redirect URL configured.
    1. In LaunchDarkly's OAuth provider registration dialog, enter your ServiceNow host URL. For example, if your ServiceNow instance is hosted at https://launchdarkly.service-now.com, enter https://launchdarkly.service-now.com.
    2. Enter the Client ID and Client Secret for the client you created in step 5.
    3. Click Register OAuth Provider.
    4. Click Allow. ServiceNow may prompt you to log in to your ServiceNow account at this step.

    Your LaunchDarkly and ServiceNow accounts are now connected. Next, you must enable the ServiceNow approvals integration for your LaunchDarkly environment.

    Configuring a LaunchDarkly environment to use ServiceNow for approvals

    By default, LaunchDarkly's approvals request feature only creates approval requests in LaunchDarkly. You can change this behavior so LaunchDarkly creates change requests in ServiceNow. To do this, you must update your chosen environment's approval settings.

    Here's how:

    1. In LaunchDarkly, navigate to the Account settings page.
    2. Click the Projects tab.
    3. Click the name of the project with the environment you wish to configure. The Environments tab appears.
    4. Click the overflow menu on the environment you wish to configure.
    5. Select Approval settings. The "Approval settings for environment" panel appears.
    6. Change the Approval system from "LaunchDarkly" to "ServiceNow".
    7. Select the ServiceNow standard change template you wish to utilize for all proposed changes in this environment. All change requests created by LaunchDarkly will include relevant details for the Short description, Justification, and Requested by fields. We recommend choosing a template with all other change request fields pre-populated.
    8. (Optional) Fill in the Detailed information column name field with the name of the ServiceNow Change Request column you would like LaunchDarkly to populate with detailed approval request information. This field defaults to justification if no value is provided.
    9. Click Save settings.
    LaunchDarkly environment approval settings with ServiceNow configured.
    LaunchDarkly environment approval settings with ServiceNow configured.

    Creating a LaunchDarkly workflow in ServiceNow for manual approvals

    You can create your workflow using either of the two methods ServiceNow offers to create new workflows:

    The screenshots below are from the Flow Designer, but you can create a workflow the same triggers, actions, and conditions using the Workflow Editor if you prefer.

    To create a LaunchDarkly approvals workflow in ServiceNow:

    1. Create a new Workflow Trigger for record "Created" on the "Change Request [change_request]" table.
    2. Set two conditions on your trigger: "State" is "New" and "Standard Change Template version > Template > Name" is "LaunchDarkly template."
    A configured Workflow Trigger in the ServiceNow Flow Designer.
    A configured Workflow Trigger in the ServiceNow Flow Designer.
    1. Add a new "Ask For Approval" Action on your Trigger Change Request Record and set the approval rules.
    A ServiceNow "Ask For Approval" action configuration.
    A ServiceNow "Ask For Approval" action configuration.
    1. Add an if condition that requires Approval State is "Approved."
    A ServiceNow if condition configured for change request approvals.
    A ServiceNow if condition configured for change request approvals.
    1. Add two "Update Change Request Record" Actions as extensions of the if condition.
    • Set the first Action to "Update Record" with "State" "Scheduled" on the latest version of the triggering Change Request Record.
    • Set the second Action to "Update Record" with "State" "Implemented" on the latest version of the triggering Change Request Record.
    You must use two update actions

    ServiceNow requires change request records to move through states in a certain order, so you must create two separate actions that move the record State first to "Scheduled" and then to "Implemented." The record must end in the "Implemented" state for LaunchDarkly to process the approval.

    A ServiceNow update change request record action that moves the "State" to "Scheduled."
    A ServiceNow update change request record action that moves the "State" to "Scheduled."
    1. As an extension of the else condition, add an "Update Change Request Record" Action that moves the "State" to "Canceled." LaunchDarkly uses this state to determine that the approval request has been rejected.
    A ServiceNow update change request record action that moves the "State" to "Canceled."
    A ServiceNow update change request record action that moves the "State" to "Canceled."

    You can now request manual approvals in ServiceNow for flag changes in LaunchDarkly.

    A complete ServiceNow workflow for LaunchDarkly manual flag approvals.
    A complete ServiceNow workflow for LaunchDarkly manual flag approvals.

    Creating a LaunchDarkly workflow in ServiceNow for automatic approvals

    Automatic approval workflows create a correlating ServiceNow Change Request for any LaunchDarkly flag changes. Automatic approvals are for record-keeping only and no actual approval is requested. Automatic approval workflows resemble manual approval workflows but without the approval Action.

    To create an automatic approval workflow:

    1. Create a new Workflow Trigger for record "Created" on the "Change Request [change_request]" table.
    2. Set two conditions on your trigger:
    • "State" is "New"
    • "Standard Change Template version > Template > Name" is "LaunchDarkly auto-approve template"
    A Workflow Trigger in the ServiceNow Flow Designer.
    A Workflow Trigger in the ServiceNow Flow Designer.
    1. Add two "Update Change Request Record" Actions as extensions of the if condition.
    2. On the first Action, set the Action to "Update Record" on the latest version of the triggering Change Request Record. Set "State" to "Scheduled.""
    3. On the second Action, set the Action to "Update Record" on the latest version of the triggering Change Request Record. Set "State" to "Implemented."
    You must use two update actions

    ServiceNow requires change request records to move through states in a certain order, so you must create two separate actions that move the record State first to "Scheduled" and then to "Implemented." The record must end in the "Implemented" state for LaunchDarkly to be able to process the record.

    A ServiceNow update change request record action that moves the "State" to "Implemented."
    A ServiceNow update change request record action that moves the "State" to "Implemented."

    You can now track your LaunchDarkly flag changes in ServiceNow.

    A completed ServiceNow workflow for LaunchDarkly "automatic" approvals.
    A completed ServiceNow workflow for LaunchDarkly "automatic" approvals.