RITM should be closed after setting state as Rejected and comments to be mandatory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2023 09:22 AM
Hello Everyone,
I have a one approval activity in workflow, I have used setvalues activity and set the state as Rejected when approval is rejected. By doing this am able to get the state as Rejected in the RITM but its not getting closed and I need to make the additional comments as mandatory too before the RITM is closed so that user can fill in the reason for rejection before the RITM is closed.
Kindly help me in achieving this.
Regards
Poorna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2023 09:31 AM
HI,
This is usually done via a client script or UI policy on the approval record, When Approval is rejected the comments or rejection reason are mandatory. These same rejection reason can be copied in the workflow to your RITM and it can be closed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2023 05:48 AM
Hello Tripathi,
Thanks for your response. May I request you to provide the code for the exact solution.
Regards
Poorna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2023 05:58 AM
Try this
Create after update BR on sysapproval_approver table
Condition: Comments Changes AND current.source_table == 'sc_req_item' and Status changes to reject
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var ritm = new GlideRecord('sc_req_item');
ritm.get(current.sysapproval);
ritm.comments = current.comments.getJournalEntry(1);
ritm.update();
})(current, previous);
reate after update BR on sysapproval_approver table
Condition: Comments Changes AND current.source_table == 'sc_req_item'
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var ritm = new GlideRecord('sc_req_item');
ritm.get(current.sysapproval);
ritm.comments = current.comments.getJournalEntry(1);
ritm.update();
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2023 11:00 AM
Hello Tripathi,
The above code will be applicable to all the catalog items but for only one specific catalog item it should be applicable.