How to create report of RITMs with skipped approval in which workflow is used?

MohammadAtR
Tera Contributor

RITMs with Skipped Approval

 

1. Create a script include named 'RITMSkipped', make sure to enable Client Callable and SandBox Enabled

Code: 

var RITMSkipped = Class.create();
RITMSkipped.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getRITMSkipped: function() {
var skippedRITM = [];
var gr = new GlideRecord('wf_history');
gr.addQuery('result', 'skipped');
gr.query();
while (gr.next()) {
var wfContextGR = new GlideRecord('wf_context');
if (wfContextGR.get(gr.context)) {
var wfContextSysId = wfContextGR.getValue('sys_id');
var wfContextID = wfContextGR.getValue('id'); // The 'ID' field of wf_context
var numRITM = new GlideRecord('sc_req_item');
numRITM.addQuery('sys_id', wfContextID);
numRITM.query();
while (numRITM.next()) {
skippedRITM.push(numRITM.sys_id.toString());
}
}
}
return skippedRITM;
},
type: 'RITMSkipped'
});

 

2. Go to Reports> Create New> 'sc_req_item' as table>Type as list>configure columns as per need>filter using sys_id 'is one of' javascript: new global.RITMnoApprover().getRITMnoApprover()

MohammadAtR_0-1771513605505.png

 

Kindly mark it as helpful or drop a comment in case of any doubts

 

4 REPLIES 4

MohammadAtR
Tera Contributor

apologies... In step 2, use "javascript: new global.RITMSkipped().getRITMSkipped()

Dr Atul G- LNG
Tera Patron

Please add the prefix “Blog / Article” so it is easy to identify whether the content is an issue or informational.

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

I am unable to do it, I read somewhere that I need to be member of rising star community to post in blog... 

😞

Add prefix in title.  You are right, RS/MVP can write blog as of now.

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************