We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Copy custom variable in record producer to OOTB record producer attachment

ronro2
Tera Contributor

Hey! 

In a record producer I have a custom variable of type attachment called 'bifoga_fil':

ronro2_0-1777024047068.png



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. 

ronro2_0-1777023445003.png


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, 

1 ACCEPTED SOLUTION

@ronro2 

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! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

29 REPLIES 29

@Ankur Bawiskar The record producer creates recors on x_vgll_rail_request (child table of x_vgll_rail_task). But it still only puts the attachment in the banner I realised, and not in the log section. I want it to be put in the log section as well. 

When I change to the parent table, then it maps to only the log, and not to the banner. So it's either or..

@ronro2 

it worked for me, I created record producer on incident which is child of task table

It copied and added message to log as well

56.png55.png57.png

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

HI @ronro2 ,
open sys_attachment table record and under Application Access
1.Accessible from =All application scopes
2.check Can Create and save.
Screenshot 2026-04-27 at 1.43.44 PM.png

You can also use the script as mentioned by @Ankur Bawiskar ,which is OOTB

new global.VariableUtil().copyAttachment(producer.<variableName>,'<tableName>', current.sys_id);

 

HI @ronro2 ,

Rakesh_M_0-1777286061172.png

Just a quick check—did you define attach_sysid like this?

var attach_sysid = producer.bifoga_fil



 

ronro2
Tera Contributor

Yes, I did adapt the script @Rakesh_M 

And it looks like this in my instance: 

ronro2_1-1777384840528.png


But still that error message comes.