g_form.getValue("sysparm_item_guid") not working

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 12:11 PM
Hi
i was getting no value when using g_form.getValue("sysparm_item_guid") i have verified it using alert it is displaying empty. I have used UniqueValue() but the sys_id are different and also i have used gel it is also not working can anyone help me how to guid value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 12:28 PM
Hello @Community Alums ,
Please give more information or script screenshot.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 12:33 PM
@Alka_Chaudhary The cataog client script i have used is below:
function onSubmit() {
var cat_id = g_form.getValue("sysparm_item_guid");
alert(cat_id);
var gr = new GlideRecord("sys_attachment");
gr.addQuery("table_name", "catalog_category_request");
gr.addQuery("table_sys_id",cat_id);
gr.query();
if (!gr.next()) {
alert("You must add an attachment before submitting this request.");
return false;
}
}
When i start submitting the record producer it is displaying same statement and not getting submitted.so when i use cat_id as alert then it is displaying the value as empty as per my analysis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 12:38 PM
Use 'g_form.getUniqueValue()' instead of 'g_form.getValue("sysparm_item_guid");'. will fix the script.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 12:45 PM
@Alka_Chaudhary I have tried using g_form.getUniqueValue() but i was getting same issue the alert "You must add an attachment before submitting this request." is coming repeatedly and not submitting even i have attached the attachment