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 04:22 AM
copy paste this code :
answer = ifScript();
function ifScript(){
var grr= new GlideRecord('sys_attachment');
grr.addQuery('table_sys_id', current.sys_id); // also try for file name if needed
grr.query();
if(grr.next()){
return true;
}else{
return false;
}
}
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 04:37 AM
Hi @Sohail Khilji ,
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:50 AM - edited 04-22-2024 04:53 AM
For this you you need to adjust the workflow to check if the current record is added with attachement in the 'wait for condition'. based on the condition it will move the flow forward...
also remember the flow will not move forward unless you nudge the ritm table as your checking for the condition on attachement table.
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 11:10 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2024 01:57 AM
Hi @sanvi,
Yes you can try in onSubmit client script
function onSubmit() {
if (g_form.getValue('your_variable') == "your_variable_value") { // This is the field value of the question you want to check
try {
var msg = 'This request requires an attachment. Please review the form and try again.';
var attachments = document.getElementById('header_attachment_list_label');
if (attachments.style.visibility == 'hidden' || attachments.style.display == 'none') {
alert(msg);
return false;
}
}
//For Service Portal
catch (e) {
var count = getSCAttachmentCount();
if (count <= 0) {
alert(msg);
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.