- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Friday - last edited Friday
Hey!
In a record producer I have a custom variable of type attachment called 'bifoga_fil':
So I want to copy this to the OOTB attachment on the record producer in the back-end, so that the attachment is visible in the banner above and in the logs.
I've marked what I mean with red.
So, I am thinking an after insert business rule of some kind? What would that look like?
I'm thankful for your help.
All good,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Monday
the file should get attached to the record if you used the record producer script
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Friday
@Ankur Bawiskar the issue is that it doesn't show in the background as an attachment in the logs and in the banner above. Because it is not mapped to the OOTB sys_attachment? I guess.
Or am I missing your point?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Friday
yes you missed my point
1) have attachment variable and make it mandatory based on your condition
2) then use this script in record producer script and then that file attached on variable will be copied to the target record on record header
new global.VariableUtil().copyAttachment(producer.<variableName>,'<tableName>', current.sys_id);
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Monday
Any update to above?
I already shared a working solution
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Friday
Hi @ronro2 ,
Add the following script to script field of record producer
var attach_sysid = producer.bifoga_fil; //variable_name
if (attach_sysid) {
var gr = new GlideRecord("sys_attachment");
if (gr.get(attach_sysid)) {
gr.table_sys_id = current.sys_id;
gr.table_name = "incident"; //replace with table name
gr.update();
}
}- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Friday
@Rakesh_M so, I get this error message when I submit the form with an attachment:
'Write operation against 'sys_attachment' from scope 'x_vgll_rail' has been refused due to the table's cross-scope access policy'.
So they are in different scopes, is there a way to work through this in the script? To get cross scope access?
