Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In the below example we make use of the ChangeManagementSystemService to allow us to create an incident through FlexDeploy’s internal ServiceNow integration. The only thing that needs to be configured ahead of time is your ServiceNow instance in Topology->Integrations->ChangeManagement

...

Create Incident Script

Code Block
languagegroovy
//Carry out any custom action you wish for this event. Check out the documentation for reference or ideas.
//Optionally filter out events you dont want to execute by returning false on the filter script tab.
def listenerName = "Create Incident";
LOG.info("Running listener: ${listenerName}");

def cmsFields = [:];
cmsFields.short_description = "Deployment failed for ${EVENT.payload.project.projectName}";
cmsFields.description = "Deployment failed for ${EVENT.payload.project.projectName}. Environment ${EVENT.payload.environment.environmentName} executionid ${EVENT.payload.workflowExecutionId} requestor ${EVENT.payload.updatedBy}";
 
LOG.fine("Creating Service Now Incident ${cmsFields}");

def cmsObject = FLEXDEPLOY.createIncidentForWorklowRequest(EVENT.payload.workflowRequest.workflowRequestId, cmsFields, "SERVICENOW",null);
LOG.setMessage("Successfully created Service Now Incident ${cmsObject.getNumber()}");

...