# ServiceNow Change Management

**URL:** <https://community.codefresh.io/t/servicenow-change-management/648>\
**Category:** Pipeline Steps\
**Created:** [October 14, 2021, 11:45pm UTC](https://community.codefresh.io/t/servicenow-change-management/648 "2021-10-14T23:45:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![laurent.rochette](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/laurent.rochette/32/329_2.png) [@laurent.rochette](https://community.codefresh.io/u/laurent.rochette)\
**Post date:** [October 14, 2021, 11:45pm UTC](https://community.codefresh.io/t/servicenow-change-management/648/1 "2021-10-14T23:45:16Z")

</div>

A [new step](https://codefresh.io/steps/step/service-now) to integrate with ServiceNow Change Management has been added to the [marketplace](https://codefresh.io/steps)

The original version was explained in detail in the blog post but in short:

1. Create a Change request
2. Add a pending approval to your pipeline
3. The pipeline will be unblocked (approved or denied) based on the status of the Change Request"

- implement state: pipeline is approved
- Change Request cancelled: pipeline denied

The new version 1.1.0 adds also the following:

- new action to update a Change Request
- new action to close a Change Request
- all parameters are now in upper case.
- rename a few parameters for consistency
- URL to the created Change Request is added to the step

## Create Change Request:

```auto
  createCR:
    type: service-now:${{VERSION}} 
    title: Create Service Now Change Request
    stage: deploy
    arguments:
      CR_ACTION: createCR
      SN_USER: admin
      SN_PASSWORD: '${{SN_PASSWORD}}'
      SN_INSTANCE: https://INSTANCE.service-now.com
      TOKEN: ${{CF_TOKEN}}
      CR_DATA: >-
        {
          "short_description": "Application deployment to Prod", 
          "description": "Change for build ${{CF_BUILD_ID}}\nThis change was created by the Codefresh plugin", 
          "justification": "I do not need a justification\nMy app is awesome", 
          "cmdb_ci":"tomcat"
        }

  approval:
    stage: deploy
    description: "Approval to deploy to PROD"
    type: pending-approval
    timeout:
      duration: 2
      finalState: denied

```

## Update an existing Change Request

```auto
  modifyCR:
    stage: deploy
    title: "Modify the implementation plan"
    type: service-now:${{VERSION}}
    fail_fast: false
    arguments:
      CR_ACTION: updateCR
      CR_SYSID: ${{CR_SYSID}}
      SN_USER: admin
      SN_PASSWORD: '${{SN_PASSWORD}}'
      SN_INSTANCE: https://INSTANCE.service-now.com
      CR_DATA: '{"implementation_plan":"The implementation has been approved."}' 

```

## Close an existing Change Request

```auto
  closeCR:
    type: service-now:${{VERSION}}
    title: Close Service Now Change Request
    stage: post
    arguments:
      CR_ACTION: closeCR
      CR_SYSID: ${{CR_SYSID}}
      SN_USER: admin
      SN_PASSWORD: '${{SN_PASSWORD}}'
      SN_INSTANCE: https://INSTANCE.service-now.com
      CR_CLOSE_CODE: "successful"
      CR_CLOSE_NOTES: "Closed automatically by Codefresh build ${{CF_BUILD_ID}}"
      CR_DATA: '{"work_notes":"this is a message for the work notes"}'

```
