Azure DevOps - After pipeline is run, Change creation is giving error

Nithin15
Tera Expert

Installation completed as per below link :


https://docs.servicenow.com/bundle/utah-devops/page/product/enterprise-dev-ops/task/config-dev-ops-e...

Visual Studio Marketplace :


https://marketplace.visualstudio.com/items?itemName=ServiceNow.vss-services-servicenow-devops


Pipeline configured in Azure DevOps. YAML file is mentioned below.

 

# Maven

# Build your Java project and run tests with Apache Maven.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/java

pr:
  - main
  - releases/*
  
trigger:
- main

stages:
- stage: ServiceNowDev
  displayName: 'Deploy to Dev'
  jobs:
  - job: deploy_infratsructure
    displayName: Deploy to Dev
    strategy:
      matrix:
        jdk10_linux:
          imageName: "ubuntu-latest"
          jdkVersion: "1.10"
        jdk11_windows:
          imageName: "windows-latest"
          jdkVersion: "1.11"
      maxParallel: 1
    pool:  
      vmImage: $(imageName)
    steps:
      - task: Maven@4
        inputs:
          mavenPomFile: "pom.xml"
          mavenOptions: "-Xmx3072m"
          javaHomeOption: "JDKVersion"
          jdkVersionOption: $(jdkVersion)
          jdkArchitectureOption: "x64"
          publishJUnitResults: true
          testResultsFiles: "**/TEST-*.xml"
          goals: "package"
  - job: 'ServiceNowChangeRecord'
    displayName: 'Trigger Change Record through DevOps'
    dependsOn:
    - deploy_infratsructure
    condition: succeeded()
    pool:
      name: Server
    steps:
      - task: ServiceNow-DevOps-Server-Change-Acceleration@1.38.0
        inputs:
          connectedServiceName: 'ServiceNow ITSM Pro Demo service connection'
          changeRequestDetails: |
            {
                "setCloseCode" : true,
                "attributes": {
      - task: ServiceNow-DevOps-Server-Change-Acceleration@1.38.0
        inputs:
          connectedServiceName: 'ServiceNow ITSM Pro Demo service connection'
          changeRequestDetails: |
            {
                "setCloseCode" : true,
                "attributes": {
                  "requested_by": {
                    "name": "Azure Devops test user"
                  },
                  "start_date": "2021-01-05 08:00:00",
                  "end_date": "2021-01-08 08:00:00"
                }
              }
                  "requested_by": {
                    "name": "test Azure Devops user"
                  },
                  "start_date": "2023-07-09 08:00:00",
                  "end_date": "2023-07-09 08:00:00"
                }
              }


Error received in Pipeline execution when creating change request:

==============================================================================
Task : ServiceNowDevOpsServerChangeAcceleration
Description : Add in a server job to create a change request as part of the Azure pipeline.
Version : 1.38.0
Author : ServiceNow
==============================================================================
POST https://ernstyoungllpdemo2.service-now.com//api/sn_devops/v1/devops/orchestration/changeControl?toolId=9c7756e7db332110270762ba1396193b&toolType=adop&projectNativeId=b1b70cd9-bb58-42e5-abe9-7cba2f29f7ff
Request body: {
"JobId": "89fa8707-7802-5f03-0d99-efab2273abca",
"TaskInstanceId": "b598c6c8-39c4-53f5-d5fc-52d53ba264f9",
"callbackURL": "https://nithinids.visualstudio.com/b1b70cd9-bb58-42e5-abe9-7cba2f29f7ff/_apis/distributedtask/hubs/build/plans/b75b5497-bc83-476c-960c-9938bd141079/events?api-version=2.0-preview.1",
"orchestrationTaskURL": "https://nithinids.visualstudio.com/TeamFoundationServer/_build?name=Nithin88.pipelines-java#Trigger Change Record",
"taskExecutionURL": "https://nithinids.visualstudio.com/TeamFoundationServer/_build/results?buildId=31#Trigger Change Record/",
"orchestrationTaskName": "TeamFoundationServer/Nithin88.pipelines-java#Trigger Change Record",
"buildUrl": "https://nithinids.visualstudio.com/TeamFoundationServer/_build/results?buildId=31",
"upstreamStageName": "",
"isMultiBranch": "true",
"branchName": "merge",
"buildNumber": "31",
"attemptNumber": "1",
"changeRequestDetails": "{
\"setCloseCode\" : true,
\"attributes\": {
",
"applicationName": "",
"snapshotName": ""
}
Response Code: 0
Response: An error was encountered while processing request. Exception: {"result":{"status":"Error","errorMessage":"The request to create change cannot be completed due to technical issue. For more information, see the error logs in All > DevOps > Administration > Error Logs."}}
Exception Message: The remote server returned an error: (400) Bad Request. (type WebException)

 

1 ACCEPTED SOLUTION

Nithin15
Tera Expert
# Maven

# Build your Java project and run tests with Apache Maven.
# Add steps that analyze code, save build artifacts, deploy, and more:

pr:
  - main
  - releases/*
 
trigger:
- main

stages:
- stage: ServiceNowDev
  displayName: 'Deploy to Dev'
  jobs:
  - job: deploy_infratsructure
    displayName: Deploy to Dev
    strategy:
      matrix:
        jdk10_linux:
          imageName: "ubuntu-latest"
          jdkVersion: "1.10"
        jdk11_windows:
          imageName: "windows-latest"
          jdkVersion: "1.11"
      maxParallel: 1
    pool:  
      vmImage: $(imageName)
    steps:
      - task: Maven@4
        inputs:
          mavenPomFile: "pom.xml"
          mavenOptions: "-Xmx3072m"
          javaHomeOption: "JDKVersion"
          jdkVersionOption: $(jdkVersion)
          jdkArchitectureOption: "x64"
          publishJUnitResults: true
          testResultsFiles: "**/TEST-*.xml"
          goals: "package"
  - job: 'ServiceNowChangeRecord'
    displayName: 'Trigger Change Record through DevOps'
    dependsOn:
    - deploy_infratsructure
    condition: succeeded()
    pool:
      name: Server
    steps:
      - task: ServiceNow-DevOps-Server-Change-Acceleration@1
        inputs:
          connectedServiceName: 'ServiceNow ITSM Pro Demo service connection'
          changeRequestDetails: |
            {
                "setCloseCode" : true,
                "attributes": {
                  "requested_by": {
                    "user_name": "abel.tuter"
                  },
                  "start_date": "2021-01-05 08:00:00",
                  "end_date": "2021-01-08 08:00:00"
                }
              }

View solution in original post

1 REPLY 1

Nithin15
Tera Expert
# Maven

# Build your Java project and run tests with Apache Maven.
# Add steps that analyze code, save build artifacts, deploy, and more:

pr:
  - main
  - releases/*
 
trigger:
- main

stages:
- stage: ServiceNowDev
  displayName: 'Deploy to Dev'
  jobs:
  - job: deploy_infratsructure
    displayName: Deploy to Dev
    strategy:
      matrix:
        jdk10_linux:
          imageName: "ubuntu-latest"
          jdkVersion: "1.10"
        jdk11_windows:
          imageName: "windows-latest"
          jdkVersion: "1.11"
      maxParallel: 1
    pool:  
      vmImage: $(imageName)
    steps:
      - task: Maven@4
        inputs:
          mavenPomFile: "pom.xml"
          mavenOptions: "-Xmx3072m"
          javaHomeOption: "JDKVersion"
          jdkVersionOption: $(jdkVersion)
          jdkArchitectureOption: "x64"
          publishJUnitResults: true
          testResultsFiles: "**/TEST-*.xml"
          goals: "package"
  - job: 'ServiceNowChangeRecord'
    displayName: 'Trigger Change Record through DevOps'
    dependsOn:
    - deploy_infratsructure
    condition: succeeded()
    pool:
      name: Server
    steps:
      - task: ServiceNow-DevOps-Server-Change-Acceleration@1
        inputs:
          connectedServiceName: 'ServiceNow ITSM Pro Demo service connection'
          changeRequestDetails: |
            {
                "setCloseCode" : true,
                "attributes": {
                  "requested_by": {
                    "user_name": "abel.tuter"
                  },
                  "start_date": "2021-01-05 08:00:00",
                  "end_date": "2021-01-08 08:00:00"
                }
              }