- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2020 01:00 AM
Hello All,
May i know the BR code to get the pending approval details in RITM worknotes activity ?
I have this requirements for all catalog workflow approvals , few of approvals for manager and few of them group approval which are from sysapproval_approver table.
kindly help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2020 12:10 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2020 05:00 AM
This will get you started, then you can tweak it to fit your requirements. I suggest a Business Rule running After Insert and Update on the sysapproval_approver table, with the Filter Conditions State is Requested AND Approval for.Task type is Requested Item
Here is a sample Script for the Advanced tab
(function executeRule(current, previous /*null when async*/) {
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('sys_id', current.document_id);
ritm.query();
if(ritm.next()){
ritm.work_notes = "Pending approval by " + current.approver.name + " .";
ritm.update();
}
})(current, previous);
The results for a Group approval, when the group contains these 2 members, or for a User approval going to these 2 users
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2020 10:05 AM
Thank you for help , its giving similar result .
But when the approval for Group , its giving all group members results .
Example : if group contain 20 group memebers , 20 pending approvals appearing .
Request you please provide code for update "Group Name" instead of group members.
Its fine for if pending single user , facing an issue for pending group .
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2020 10:36 AM
Hi Vandana,
if you require Group Approval information you would require BR on Group Approval table
BR: Table -> Group Approval [sysapproval_group]
Condition: Approval is Requested && Task Type is Group Approval && Parent.Number Startswith RITM
Script:
(function executeRule(current, previous /*null when async*/) {
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('sys_id', current.parent);
ritm.query();
if(ritm.next()){
ritm.work_notes = "Pending approval by " + current.assignment_group.getDisplayValue() + " .";
ritm.update();
}
})(current, previous);
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2020 11:06 AM
I have a similar Business Rule to run on the sysapproval_group table
With this script
(function executeRule(current, previous /*null when async*/) {
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('sys_id', current.parent);
ritm.query();
if(ritm.next()){
ritm.work_notes = "Pending approval by the " + current.assignment_group.name + " group.";
ritm.update();
}
})(current, previous);
You'll want to add a Filter Condition to the Business Rule running on sysapproval_approver to exclude these User approvals that are created when a Group approval is created.