Required Modification in Existing fix script of RITM Stages

thomas94
Tera Contributor

@Swathi Sarang 

 

Actually i need modification in existing script only.

Requirement: In existing script need to add that if approval is requested then no need to pick up that RITM in list ,also required list of RITMs whose stages are Waiting for Approval (value 1)and fulfillment(value 2)

please refer below URL and guide me to add stages and approvals in existing script

Solved: To pick RITM which are in open state once after th... - ServiceNow Community

 

var arr = [];
		var gr = new GlideRecord("sc_req_item");
		gr.addEncodedQuery("state=1"); // state is open
		gr.query();
		while(gr.next()) {
			var closedCount = 0;
			var taskRec = new GlideRecord("sc_task");
			taskRec.addQuery("request_item", gr.sys_id);
			taskRec.query();
			var totalCount = taskRec.getRowCount();
			while(taskRec.next()){
				if(taskRec.active.toString() == 'false'){
					closedCount++;
				}
			}

			if(closedCount == totalCount && totalCount != 0){
				// if count is same then all tasks are closed then push RITM number in array
				arr.push(gr.getValue('number'));
			}
		}
		 gs.print(arr.toString());
6 REPLIES 6

Requirement again

write a script to pick RITM which are in Open, WIP, Pending state once after the closure of child tasks (catalog tasks and approval tasks)
In existing script need to add that if approval is requested then no need to pick up that RITM in list , also required list of RITMs whose stages is not complete, Request Cancelled, closed_incomplete, closed_skipped.

but now instead of getting the approval field in query can you write a script like on approval table similar to sc_task ? (I don't want approval query in encoded query can you please write it in approval table?
 can you please provide the updated script?

vardhan3
Tera Contributor

Hi  

Swathi 
It is Urgent can you please provide the updated script for above mentioned requirement?
 
 
 
 
  
 
 
It is urgent Can you please provide the updated script on above requirement?