- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2022 10:16 AM
I need to make attachment is mandatory based on condition. There is a check box in the form If I select that one then it should become attachment mandatory how to implement that please help me out.
I have used below Script but it is become mandatory for entire form I want it for particular variable only
Please check attachment
function onSubmit() {
var cat_id = g_form.getValue('sysparm_item_guid');
var gr = new GlideRecord("sys_attachment");
gr.addQuery("table_name", "sc_cart_item");
gr.addQuery("table_sys_id", cat_id);
gr.query();
if (!gr.next()) {
alert("Attachment is mandatory if you select Preapproved");
return false;
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2022 10:51 AM
Hi,
I would suggest to use the attachment type variable for attaching the attachment and us UI policy to make it mandatory based on your required conditions.
You can achieve it with out scripting and It is recomanded as a best practices.
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2022 10:51 AM
Hi,
I would suggest to use the attachment type variable for attaching the attachment and us UI policy to make it mandatory based on your required conditions.
You can achieve it with out scripting and It is recomanded as a best practices.
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2022 11:28 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2022 06:11 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2023 06:45 AM
This attachment variable is not working currently, If you attach any thing but it does not attach in the ticket. hence we can not use that varibal.