How to Make the attachment mandatory in RITM , before approval of RITM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 12:08 AM
Hello Community,
Can you please help out in this scenario.
How to make the attachment button mandatory before approval.
Example: The approver should attach a file to RITM and then only the approve button should be enabled for the RITM.
Please help in this scenario.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 09:40 AM
Hi @Siddhant VSK ,
What about a business rule that abort the approval if there is no attachment in the RITM?
You could create a Before business rule with the following conditions: state changes to approved and approval for.task type is Requested Item, in the table: sysapproval_approver (check the screenshot)
(function executeRule(current, previous /*null when async*/) {
var attachment = new GlideRecord('sys_attachment');
attachment.addQuery('table_sys_id',current.sysapproval);
attachment.query();
if(attachment.next()){
return;
}else{
current.setAbortAction(true);
gs.addErrorMessage('You cannot approve a Requested Item without an attachment');
}
})(current, previous);
This Business rule will check the Attachment table (sys_attachment) to verify if there is any attachment associated to your requested item. If there isn't the approval will be cancelled.
If this answer is helpful, please mark my answer as correct!
Cheers