Get the current state of a change request

2 minute read

Use this functionality to get the current state, including any blackout window conflict status, of a ServiceNow change request. The user must provide:

All CloudBees action repositories are listed at CloudBees, Inc. on GitHub.

Inputs

Inputs for the get change request functionality are listed below.

Table 1. Input details
Change request model field Data type Required Description

url

String

Yes

The ServiceNow host URL.

username

String

Yes

The username used for authentication.

password

String

Yes

The password used for authentication.

client-id

String

Required only for OAuth-based authentication.

The unique identification number of the client.

client-secret

String

Required only for OAuth-based authentication.

The client secret used for authentication.

action-type

String

Yes

The type of operation must be "get".

cr-number

String

Yes

The unique number auto-generated during change request creation.

Outputs

Outputs for the get change request functionality are listed below.

Table 2. Output details
Change request model field Data type Description

number

String

The change request number.

sys_id

String

The identifier used to update the change request.

state

String

The current status of the change request.

conflict_status

String

The current conflict status of the planned dates.

Usage example: Basic

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 id: get uses: https://github.com/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"

Usage example: Refer to creation step output

The following is an example payload referring to the output parameter number from the change request creation step as input in the get step:

steps: - name: Get ServiceNow CR with output parameter ref uses: https://github.com/cloudbees-io/service-now@v1 with: url: ${{ vars.SERVICENOW_URL }} username: ${{ vars.MY_SERVICENOW_USERNAME }} password: ${{ secrets.MY_SERVICENOW_PASSWORD }} action-type: "update" cr-number: ${{ fromJSON(steps.create_cr.outputs.servicenow_output).number }} description: "Updated description from CBP workflow"