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

Not applicable

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!

 

View solution in original post

5 REPLIES 5

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

 

Not applicable

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!

 

Not applicable

Hi @jordanbarry ,

 

If this response resolved your query, please close the loop.

 

 

 

Hi Hemanth, 

 

Thank you for the help!

 

I was able to implement something similar to this using the "Look up attachment" action. I set that action source record to my desired table with the files I want. Then I used a variation of your gliderecord script to pull the sysID instead of the file name. After that I updated the record using a data pill for the attachment lookup. 

 

(For some reason my workspace would not let me use the "set flow variable" feature)