How to make attachments mandatory on SC Task based on variable condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 07:54 AM
I have a requirement to make attachment mandatory on SC Task Table if One of the variable value is Yes on a SC_TASK Table
I Have created a Before Business rule to make it mandatory , script is working fine , but i am not able to fetch the variable value with the below script
(function executeRule(current, previous /*null when async*/ ) {
var va = current.variable_pool.netstat_report;
current.addInfoMessage('Testing Catalog ' + va);
if (va == 'yes') {
var sctaskAttach = new GlideRecord('sys_attachment');
sctaskAttach.addQuery('table_sys_id', current.sys_id);
sctaskAttach.query();
if (!sctaskAttach.hasNext()) {
gs.addErrorMessage('Attachment is empty Please attach ');
current.setAbortAction(true);
}
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 08:34 AM
Share the screenshot of BR with "when to run" condition
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution