File Attachment Field to another table/record

jordanbarry
Tera Contributor

I have a table with several file attachment fields. They are all intended to store different file templates.

I have a table that uses those those templates and will reference the template table. (version control for new records)

 

When I try to set a field value via pill view in Flow Designer, the files never transfer over to the file fields in the new record. Is there a way to transfer files from file field to a file field on another table?
 

Example:

     Document Template Table

            File field 1: template_file.pdf

            File field 2: template_file.png

 

Through a lookup record, assign fields in my project table to the values of those in the document template field:

 

     Project Table

             File Field Reference Template: template_file.pdf (inherited from File field 1)

             File Field Reference Template: template_file.png (inherited from File field 2)

 

 

 

2 ACCEPTED SOLUTIONS

Uncle Rob
Kilo Patron

Are they conventional attachments at all?  If so why not use any of the existing attachment Flow Actions?

UncleRob_0-1753533288389.png

 

View solution in original post

Hemanth M1
Giga Sage
Giga Sage

Hi @jordanbarry,

 

If you use the data pill directly, it sets the file name. You need to set the sys_id of the sys_attachment record, so use a flow variable to get the sys_id as shown below, and set it using the update record action.

var atchFile = new GlideRecord("sys_attachment");
if(atchFile.get(fd_data.trigger.current.u_file_field)){
    return atchFile.sys_id;
}

Example Flow:

HemanthM1_0-1753538681128.png

Output:

HemanthM1_1-1753538789855.png

 

Copied on to the Incident task table:

HemanthM1_2-1753538851458.png

 

Hope it helps!

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

View solution in original post

5 REPLIES 5

Thank you Hemanth! Your post was able to point my in the right direction although my implementation was slightly different. I used the "Look Up Attachment" action. I set the source record as my template record and used the script for the filename. Then I had the datapill connection for an "update record" action that set the value of the field to that sys ID produced by the "Look Up Attachment" action.