Use the CloudBees ServiceNow actions to create and manage ServiceNow change requests from CloudBees Unify workflows. Two actions are available:
-
service-now: create, update/close, and get change requests. -
service-now-poll-for-approval: query a change request for approval.
| All CloudBees action repositories are listed at CloudBees, Inc. on GitHub. |
Authentication methods
The ServiceNow actions support both basic and OAuth authentication methods for connecting to ServiceNow.
-
Basic authentication: Provide a ServiceNow URL, a valid username, and a password to connect to the ServiceNow application.
-
OAuth authentication: In addition to a ServiceNow URL, a valid username, and a password, provide a ClientId and Client Secret for generating a bearer access token with an expiration date. This method is more secure.
Supported versions
CloudBees has tested and supports the following ServiceNow releases:
Other versions of ServiceNow may work with CloudBees Unify. If you are using a version of ServiceNow not listed above, submit a feature request with CloudBees Support.
Create a change request
Use this functionality to create a new change request in ServiceNow.
You must provide valid credentials (basic or OAuth authentication) and the ServiceNow host URL, and set action-type to create.
Inputs
| Change request model field | Data type | Required? | Description |
|---|---|---|---|
|
String |
Yes |
The operation type must be "create". |
|
String |
Yes |
The ServiceNow host URL. |
|
String |
Yes |
The username used for authentication. |
|
String |
Yes |
The password used for authentication. |
|
String |
Required only for OAuth-based authentication. |
The unique identification number of the client. |
|
String |
Required only for OAuth-based authentication. |
The client secret used for authentication. |
|
String |
No |
A brief title to identify the change request. |
|
String |
No |
Additional information about the change request ticket. |
|
String |
No |
The type of change request. The default value is "normal". |
|
String |
No |
The current status of the change request. |
|
String |
No |
The priority of the change request. |
|
String |
No |
The risk involved in the change request. |
|
String |
No |
The impact of the change request. |
|
String |
No |
The change request ticket category. |
|
String |
No |
The user that requested the change. |
|
String |
No |
The assignment group to which the change request must be mapped. |
|
String |
No |
The user to whom the change request ticket must be assigned in the assignment group. |
|
Boolean |
No |
Whether to check if there is a blackout window conflict. The default value is false. |
|
String |
Required if |
The scheduled start date and time of the change request, formatted as |
|
String |
Required if |
The scheduled end date and time of the change request, formatted as |
|
JSON string |
No |
Any additional parameters apart from the list provided above. Refer to the ServiceNow documentation for more information. |
Unique identifiers generated by ServiceNow
Unique cr-number and sys_id identifiers are generated by ServiceNow when the ticket is successfully created.
-
The
sys_idis a unique 32-character identifier required to update or close the ticket. -
The
cr-numberis required to get the current state of a change request and to query a change request for approval.
Outputs
| Change request model field | Data type | Description |
|---|---|---|
|
String |
The unique change request number auto-generated during change request creation. |
|
String |
The identifier auto-generated during change request creation. |
|
String |
The current status of the change request. |
Usage examples
The following is an example payload for creating a change request using basic authentication:
If your workflow uses a manual trigger, you can configure input parameters for the ServiceNow change request fields in the format ${{ inputs.MY_PARAMETER }}, which can then be passed to the action inputs.
The following is an example payload for creating a change request using basic authentication and input parameters:
| Use the Workflow composer to configure input parameters for a manually triggered workflow. |
The following is an example payload for creating a change request using OAuth-based authentication and checking for any blackout windows within the planned change request start and end dates:
Times specified in the planned-start-date and planned-end-date fields are evaluated to be in the UTC time zone by default.
If the time zone is already configured in the ServiceNow instance, then the fields are evaluated to be in the ServiceNow-configured time zone.
|
If validate-blackout-window-conflict is set to true, the action performs an additional check before creating the change request.
You must input both planned start and end dates and times.
The action checks ServiceNow for the configuration of a blackout window during the planned start and end dates provided:
-
If a blackout window exists during the scheduled dates, the action fails and the change request is not created.
-
If no blackout window conflict is detected, the action creates the change request.
Get the current state of a change request
Use this functionality to get the current state, including any blackout window conflict status, of a ServiceNow change request.
You must provide valid credentials (basic or OAuth authentication), the ServiceNow host URL, action-type: get, and the cr-number auto-generated during change request creation.
Inputs
| Change request model field | Data type | Required? | Description |
|---|---|---|---|
|
String |
Yes |
The ServiceNow host URL. |
|
String |
Yes |
The username used for authentication. |
|
String |
Yes |
The password used for authentication. |
|
String |
Required only for OAuth-based authentication. |
The unique identification number of the client. |
|
String |
Required only for OAuth-based authentication. |
The client secret used for authentication. |
|
String |
Yes |
The type of operation must be "get". |
|
String |
Yes |
The unique number auto-generated during change request creation. |
Outputs
| Change request model field | Data type | Description |
|---|---|---|
|
String |
The change request number. |
|
String |
The identifier used to update the change request. |
|
String |
The current status of the change request. |
|
String |
The current conflict status of the planned dates. |
Update or close a change request
Use this functionality to update or close an existing ServiceNow change request.
You must provide valid credentials (basic or OAuth authentication), the ServiceNow host URL, action-type: update, and the sys-id returned by the change request creation response.
Inputs
| Change request model field | Data type | Required? | Description |
|---|---|---|---|
|
String |
Yes |
The ServiceNow host URL. |
|
String |
Yes |
The username used for authentication. |
|
String |
Yes |
The password used for authentication. |
|
String |
Required only for OAuth-based authentication. |
The unique identification number of the client. |
|
String |
Required only for OAuth-based authentication. |
The client secret used for authentication. |
|
String |
Yes |
The type of operation must be "update" for both updating and closing a change request. |
|
String |
Yes |
The identifier auto-generated during change request creation. |
|
String |
Required for the close operation only if configured as mandatory fields in ServiceNow for closing a ticket. |
The code assigned to the change request by the user closing it. For example, "successful", "successful with issues", or "unsuccessful". |
|
String |
Required for the close operation only if configured as mandatory fields in ServiceNow for closing a ticket. |
The notes entered by the user closing the change request. |
|
String |
No |
A short title for easy identification. |
|
String |
No |
Additional information about the change request ticket. |
|
String |
No |
The type of change request. The default value is "normal". |
|
String |
No |
The current status of the change request (matches the ServiceNow configuration). |
|
String |
No |
The priority of the change request. |
|
String |
No |
The risk involved in the change request. |
|
String |
No |
The impact of the change request. |
|
String |
No |
The change request ticket category. |
|
String |
No |
The user that requested the change. |
|
String |
No |
The assignment group to which the change request must be mapped. |
|
String |
No |
The user to whom the change request ticket must be assigned in the assignment group. |
|
JSON String |
No |
Any additional parameters apart from the list provided above. Refer to the ServiceNow documentation for more information. |
Outputs
| Change request model field | Data type | Description |
|---|---|---|
|
String |
The identifier used for change request updates. |
|
String |
The current status of the change request. |
Usage examples: Update a change request
The following is an example payload for updating a change request using basic authentication:
The following is an example payload referring to the output parameter sys_id from the change request creation step as input in the update step:
Usage examples: Close a change request
The following is an example payload for closing a change request:
The following is an example payload referring to the output parameter sys_id from the change request creation step as input in the close step:
| For information about using input parameters in a manually triggered workflow, refer to the Create change request usage example. |
Query a change request for approval
Use this functionality to query an existing ServiceNow change request for approval.
You must provide valid credentials (basic or OAuth authentication), the ServiceNow host URL, the cr-number auto-generated during change request creation, and at least one of the following:
-
The current state to poll for, specified by
state-field-value. -
The approval and rejection values to poll for, specified by
approval-field-value-approvedandapproval-field-value-rejected.
Inputs
| Change request model field | Data type | Required? | Description |
|---|---|---|---|
|
String |
Yes |
The ServiceNow host URL. |
|
String |
Yes |
The username used for authentication. |
|
String |
Yes |
The password used for authentication. |
|
String |
Required only for OAuth-based authentication. |
The unique identification number of the client. |
|
String |
Required only for OAuth-based authentication. |
The client secret used for authentication. |
|
String |
Yes |
The unique number auto-generated during change request creation. |
|
String |
No |
The polling interval, in minutes, for the action to periodically check the approval status in ServiceNow.
Default is |
|
String |
No |
The maximum time duration, in minutes, for the action to continue polling for approval status in ServiceNow.
Default is |
|
String |
Required if |
The value of the state field in ServiceNow.
The action continues to poll until the state field in ServiceNow matches |
|
String |
Required if |
The value of the approval field in ServiceNow that indicates the change request is approved. The action continues to poll until the approval field in ServiceNow is either "approved" or "rejected". |
|
String |
Required if |
The value of the approval field in ServiceNow which indicates that the change request is rejected. The action continues to poll until the approval field in ServiceNow is either "approved" or "rejected". |
Outputs
| Change request model field | Data type | Description |
|---|---|---|
|
String |
The unique change request number auto-generated during change request creation. |
|
String |
The identifier auto-generated during change request creation. |
|
String |
The value of the approval field in ServiceNow. |
|
String |
The current status of the change request. |
Usage examples
The following is an example payload for querying a change request for approval using OAuth-based authentication and both state and approval values:
The following is an example payload for querying a change request for approval using basic authentication and the state value:
The following is an example payload for querying a change request for approval using OAuth-based authentication and approval values:
The following is an example referring to the output parameter number from the change request creation step as input in the poll for approval step: