Created
April 19, 2023 17:15
-
-
Save waldothedeveloper/3cd796534b5ecd61b2ecc55379045c61 to your computer and use it in GitHub Desktop.
Activity Properties: Run Script -> Decom Servers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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