Making attachment mandatory on RITM after closure of task
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 03:40 AM
Hi All,
I have a requirement.
Attachment should be made mandatory on RITM after closure of a task which is driven by a workflow.
Tried adding in the workflow but its not working out. Have added below script in the if condition in the workflow.
Even though there is no attachment the workflow is end
Could someone help me how to achieve this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 03:51 AM
Hi @sanvi
can you try the below code?
function onSubmit() {
var grAtt = new GlideRecord("sys_attachment");
grAtt.addQuery("table_name", "sc_cart_item");
grAtt.addQuery("sys_created_by", g_user.userName);
grAtt.query();
if (!grAtt.next()) {
alert("You must attach a vendor quote to submit this request");
return false;
}
return true;
}
Thanks
dgarad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 04:07 AM
Hi @sanvi,
Try below script it may help you.
answer = ifScript();
function ifScript(){
var att = new GlideRecord('sys_attachment');
att.addQuery('table_sys_id', current.sys_id); // request item's sys_id
att.query();
if(att.next()){
return true;
}else{
return false;
}
}
If my response helps you to resolve the issue close the question by Accepting solution and hit thumb icon. From Correct answers others will get benefited in future.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 04:37 AM - edited 04-22-2024 04:38 AM
Hi @Mohan raj ,
The script is working but, the workflow should not progress further until there is an attachment in the RITM.
Once there is an attachment i want to flow to proceed further.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 04:54 AM