Use this action to perform the following ServiceNow operations using the CloudBees platform:
The ServiceNow action supports both basic and OAuth authentication methods to connect with 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.
CloudBees has tested and supports the following ServiceNow releases:
Other versions of ServiceNow may work with the CloudBees platform. If you are using a version of ServiceNow not listed above, submit a feature request with CloudBees Support.
Use this functionality to create a new change request in ServiceNow. The user must provide:
-
Valid credentials and the ServiceNow host URL.
-
The create action type.
Inputs for the create change request functionality are listed below.
Change request model field | Data type | Required? | Description |
---|---|---|---|
|
String |
Yes |
The type of operation is "create". |
|
String |
Yes |
The ServiceNow host URL. |
|
String |
Yes |
The username for authentication. |
|
String |
Yes |
The password 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 for authentication. |
|
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. |
|
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 cr-number
and sys_id
identifiers are generated by ServiceNow when the ticket is successfully created.
-
The
sys_id
is a unique 32-character identifier required to update or close the ticket. -
The
cr-number
is required to get the current state of a change request and to query a change request for approval.
The following is an example payload for creating a change request using basic authentication:
steps:
- name: Create ServiceNow CR with basic auth
uses: cloudbees-io/service-now@v1
with:
url: ${{ vars.SERVICENOW_URL }}
username: ${{ secrets.MY_SERVICENOW_USERNAME }}
password: ${{ secrets.MY_SERVICENOW_PASSWORD }}
action-type: "create"
cr-type: "normal"
short-description: "Title of the CR ticket"
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:
steps:
- name: Create ServiceNow CR with manual trigger
uses: cloudbees-io/service-now@v1
with:
url: ${{ vars.SERVICENOW_URL }}
username: ${{ secrets.MY_SERVICENOW_USERNAME }}
password: ${{ secrets.MY_SERVICENOW_PASSWORD }}
action-type: create
cr-type: Normal
short-description: ${{ inputs.Short_Description }}
description: ${{ inputs.Description }}
If the parameter validate-blackout-window-conflict
is set to true, the action performs an additional check before creating the change request.
When this parameter is set to true, you must input both planned start and end dates and times. The action checks ServiceNow for configuration of a blackout window during the planned start and end dates provided in the change request.
-
If a blackout window exists during the scheduled dates, then the action fails and the change request is not created.
-
If no blackout window conflict is detected, the action then proceeds to create the change request.
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:
steps:
- name: Create ServiceNow CR and check for blackout window
uses: cloudbees-io/service-now@v1
with:
url: ${{ vars.SERVICENOW_URL }}
username: ${{ vars.MY_SERVICENOW_USERNAME }}
password: ${{ secrets.MY_SERVICENOW_PASSWORD }}
client-id: ${{ secrets.MY_CLIENT_ID }}
client-secret: ${{ secrets.MY_CLIENT_SECRET }}
action-type: create
cr-type: Normal
short-description: 'check for blackout window'
validate-blackout-window-conflict: true
planned-start-date: "2025-03-06 17:00:00"
planned-end-date: "2025-03-06 17:59:59"
Note
|
Times specified in planned-start-date and planned-end-date are evaluated to be in the time zone set in your user profile.
|
Use this functionality to update or close an existing ServiceNow change request. The user must provide:
-
Valid credentials and the ServiceNow host URL.
-
The update action type.
-
The unique sys_id attribute returned by the change request response.
Inputs for the change request functionality are listed below.
Change request model field | Data type | Required | Description |
---|---|---|---|
|
String |
Yes |
The ServiceNow host URL. |
|
String |
Yes |
The username for authentication. |
|
String |
Yes |
The password 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 for authentication. |
|
String |
Yes |
The type of operation is "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. |
The following is an example payload for updating a change request using basic authentication:
- name: Update ServiceNow CR with basic auth
uses: cloudbees-io/service-now@v1
with:
url: ${{ vars.SERVICENOW_URL }}
username: ${{ secrets.MY_SERVICENOW_USERNAME }}
password: ${{ secrets.MY_SERVICENOW_PASSWORD }}
action-type: "update"
sys-id: "the unique system-generated string"
description: "Updated description from CBP workflow"
priority: "3 - Moderate"
risk: "Low"
additional-parameters : '{"risk_impact_analysis":"Describe the risks here","implementation_plan": "Describe the implementation plan here"}'
The following is an example payload for closing a change request:
- name: Close ServiceNow CR with mandatory close fields
uses: cloudbees-io/service-now@v1
with:
url: ${{ vars.SERVICENOW_URL }}
username: ${{ vars.MY_SERVICENOW_USERNAME }}
password: ${{ secrets.MY_SERVICENOW_PASSWORD }}
client-id: ${{ secrets.MY_CLIENT_ID }}
client-secret: ${{ secrets.MY_CLIENT_SECRET }}
action-type: "update"
sys-id: "Unique ServiceNow-generated identifier"
state: "close"
close-code: "successful"
close-notes: "Change request closed in successful state"
Note
|
For information about using input parameters in a manually triggered workflow, refer to the Create change request usage example. |
Use this functionality to get the current state, including any blackout window conflict status, of a ServiceNow change request. The user must provide:
-
Valid credentials and the ServiceNow host URL.
-
The get action type.
-
The cr-number auto-generated during change request creation.
Inputs for the get change request functionality are listed below.
Change request model field | Data type | Required | Description |
---|---|---|---|
|
String |
Yes |
The ServiceNow host URL. |
|
String |
Yes |
The username for authentication. |
|
String |
Yes |
The password 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 for authentication. |
|
String |
Yes |
The type of operation is "get". |
|
String |
Yes |
The unique number auto-generated during change request creation. |
The following is an example payload with basic authentication to get the current change request state:
steps:
- name: Get ServiceNow CR state with basic auth
uses: cloudbees-io/service-now@v1
with:
url: ${{ vars.SERVICENOW_URL }}
username: ${{ vars.MY_SERVICENOW_USERNAME }}
password: ${{ secrets.MY_SERVICENOW_PASSWORD }}
action-type: "get"
cr-number: "Unique ServiceNow-generated number"
This code is made available under the MIT license.
-
Learn more about using actions in CloudBees workflows.
-
Learn about the CloudBees platform.