Approval history for User Approval not showing in RITM activity
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2019 07:25 AM
I have an user approval in my workflow. Once the user approves it, the approval history(journal field) is updated with comments as "XXXX approved the task". This comment should reflect in the RITM activity as well. When I modify the approval history filed manually, then I can see the value added to the RITM activity.
Is there any thing needed, to show the approval history added through a business rule to reflect in the RITM activity.
Thanks,
Sindhuja
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2019 01:04 PM
Easiest way to do this is to write a Business Rule on the sysapproval_approver table.
Something like this (not tested):
Type: After Update
Advanced: True
Conditions: State changes to Approved
Approval For.Task Type is Requested Item
Script:
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord("sc_req_item");
if(gr.get(current.sysapproval)){
gr.comments = "whatever message you want to put here";
gr.update();
}
})(current, previous);
For the comment, you'll have to get creative when pulling in who actually approved the request. If you just want their username you can go with something like "current.sys_updated_by + ' approved the task'". If you want something a little more in depth, giving the approvers actual name, you'll need to do a quick GlideRecord lookup to the user table using the sys_updated_by value and pull back their name.
You could always pull in who the approver for the record is and use their name, but that's not always a guarantee as to who actually approved the record (delegates, approval admins, etc).
Hopefully this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2019 06:17 AM
Hi Sindhuja,
Have you find out any solution?