Skip to content

Instantly share code, notes, and snippets.

@waldothedeveloper
Created April 19, 2023 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waldothedeveloper/3cd796534b5ecd61b2ecc55379045c61 to your computer and use it in GitHub Desktop.
Save waldothedeveloper/3cd796534b5ecd61b2ecc55379045c61 to your computer and use it in GitHub Desktop.
Activity Properties: Run Script -> Decom Servers
var queryString = "task=" + current.sys_id;
var grTaskService = new GlideRecord("task_cmdb_ci_service");
grTaskService.addEncodedQuery(queryString);
var isValidQuery = grTaskService.isEncodedQueryValid(queryString);
var CIstoRetire = [];
if (isValidQuery) {
grTaskService.query();
while (grTaskService.next()) {
CIstoRetire.push(grTaskService.cmdb_ci_service.toString());
}
new Conviva_WorkflowUtils().StandardChangeServerRetirement(
CIstoRetire,
current.number
);
} else {
gs.addErrorMessage(
"The system has not been able to select the services to be retired. Please try again, or contact your ServiceNow support admin."
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment