Not getting sys id of the attachment when using g_form.getValue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2022 08:11 PM
Hi. I need to grab the sys id of the submitted Attachment variable so that I can push the same image ( submitted by the user) to sc_cat item table.
I am not getting the sys_id of the attachment variable. It is coming blank when I am using getValue method. pls suggest.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2022 10:50 PM
So we can achieve this even without creating attachments by referring the sys_id of attachment that user attached in submitting the record. But the risk is if someone accidentally delete the attachment from that record then the catalog item also looses the attachment.
SO I went for the approach of creating attachments. If you feel the script is running slow then you can make the BR as async to run it in background.
And the approach that I referenced without GlideRecord is very simple that you need to set the value of icon and attachment with the sys_id value of icon and picture variables of user submitted record.
To your question on not getting variable values....what is the exact code you used to retrieve the icon, picture variable values?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2022 07:16 AM
I used..... current.variables.getValue("attachment variable). It doesnt work.. but I can query using Table_Sys_id.
Anyways, I found another way to do it, so I should be good now.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2022 07:24 AM
Regards,
Vamsi S
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2022 09:46 PM
Hi,
Are you planning to do this once RITM is submitted?
You can use workflow run script and it should be an easy task
Can you share what script did you start with?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2022 10:08 PM
Hi Ankur,
I am trying to do this via Business rule and trying it as Vamsi suggested above. But his script has way too many Gliderecords so I am seeing how to achive this.
Also, His script is inserting record into sys_attachment which I dont want ( that will happen automatically). All I want is to insert picture into appropriate catalog Item