- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2022 07:04 AM
Hi All,
Good Day!
I was asked to the below requirement and as my task doesn't mainly include scripting I'm trying to process what is being asked here:
- Create a new function called ChangeManagementUtil called "isContainsRetiredCIs" which accepts the change request as the parameter:
- This will be query the task_ci table and returns false if the CI's operational status is Retired, otherwise return true.
I have done the below script but it doesn't seem to be working and I'm not sure if I'm on the right path to achieve the above requirement.
isContainsRetiredCIs: function(change_request) {
var taskGR = new GlideRecord('task_ci');
taskGR.addQuery('operational_status');
taskGR.query();
while (taskGR.next()) {
if(taskGR.operational_status != 'Retired'){
taskGR.isValidRecord();
};
},
Also can you please advise as to how I can test it using the background script app? Since currently what I do is I save this script include update and go to the change_request table > Add an Affected CIs to see if it's working. The goal here is to make sure the Retires CIs and affected CIs can't be selected in a change request. Appreciate your asistance on this!
Solved! Go to Solution.
- Labels:
-
Script Debugger
-
Scripting and Coding