- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2022 03:33 AM
Hi All,
I have catalog item and it has Attachment type variable.
once file selected in that filed i need to do some work based on the attached document, for that i need to access the attachment before submitting the catalog item..
The below script is work only in the native view to get unique value in the attachment table but its not working in the portal.
g_form.getValue('sysparm_item_guid');
Please help me how to do that.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2022 04:06 AM
Hello @ramesh_r
I assume you want to query attachment table the record with name "user list.xlsx". This you can do by querying sys_attachment table with sys_id of the attachment record. You can read sys_id of the attachment record using g_form.getValue("ATTACHMENT_TYPE_VARIABLE_NAME");
you can write script like:
var grAtt = new GlideRecord("sys_attachment");
grAtt.get("SYS_ID_GOT_FROM_ABOVE_SCRIPT");
The attachment type variable stores attachment record sys_id as value.
Thank you,
Ali
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2022 03:55 AM - edited 10-25-2022 03:55 AM
To get the Unique value of the catalog item you can use g_form.getUniqueValue(); for the service portal view
For more information - "sysparm_item_guid" does not work for Service Portal. Use g_form.getUniqueValue() instead.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2022 04:09 AM
Hi Sai,
this g_form.getUniqueValue(); is not giving the same value as g_form.getValue('sysparm_item_guid')
its just returning catalog sys id g_form.getUniqueValue();.
i am looking for thr out put what this one is retune
g_form.getValue('sysparm_item_guid')

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2022 04:06 AM
Hello @ramesh_r
I assume you want to query attachment table the record with name "user list.xlsx". This you can do by querying sys_attachment table with sys_id of the attachment record. You can read sys_id of the attachment record using g_form.getValue("ATTACHMENT_TYPE_VARIABLE_NAME");
you can write script like:
var grAtt = new GlideRecord("sys_attachment");
grAtt.get("SYS_ID_GOT_FROM_ABOVE_SCRIPT");
The attachment type variable stores attachment record sys_id as value.
Thank you,
Ali
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2025 01:26 AM
Please update if you found any solution for this