- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2020 09:11 PM
This code is giving the alert of if condition and stopping the submission even i am attaching a file.
whats wrong in my code?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2020 11:24 PM
Hi,
It is not recommended to use GlideRecord in client scripts still if you want to achieve by client scripts then you can try with below code.
function onSubmit() {
//Type appropriate comment here, and begin script below
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("You must add an attachment before submitting this request.");
return false;
}
}
Thanks,
Pooja M
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2020 10:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2020 10:47 AM
Hi Uma,
You can directly paste the code it will you don't have to put any additional value.Its complete code.
Make sure that sure have made the isolate script field to false as mention in the above step.
For more information on the header_attachment_list_label This is the id of the element which stores the attachment.
screesnshot:
Mark helpful and correct if it helps
Thanks,
CB