Copy RITM attachments to Approval records using Flow designer

Nagarjuna13
Tera Contributor

Hi,

 

How, we can copy RITM attachments to Approval records using Flow designer?

Thanks in Advance!

 

Regards,

Nagarjuna

3 REPLIES 3

Ankur Bawiskar
Tera Patron

@Nagarjuna 

refer below links for help

Flow Designer- Copying HR task attachment on insertion(1 record ) to parent HR case

Unable to copy attachments using flow designer - recommended to check

Flow Designer: Copy Attachments Not Working response from Eric

Creating custom Action to copy attachments in flow - if you want to handle via custom action

Regards
Ankur

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

Ankur Bawiskar
Tera Patron

Hi,

here is a working example of copying all attachments from incident_task to incident table

Remember to Save and Activate the flow

Name of flow is incorrect it should be INC Task to INC

Flow

find_real_file.png

Lookup Records on sys_attachment where Table Sys Id = Incident Task Record Sys Id

find_real_file.png

Lookup Record on Incident table where Sys Id = Incident Task -> Parent

find_real_file.png

Then use For each on the Lookup records to iterate over each attachment record

find_real_file.png

Then use OOB Copy Attachment Action and select the Attachment Record as the one for which the loop is running

Target record as the Incident Record

find_real_file.png

 

Regards
Ankur

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

Victor29
Tera Contributor
Script to paste into the Run Script action

Place this immediately after your "Create Task" or "Ask for Approval" step:

javascript

// Copy all attachments from RITM to the target record
var ritm = current;  // the triggering RITM
var targetSysId = fd_data.create_task.sys_id;  // replace with your action's output pill
var targetTable  = 'sc_task';  // or 'sysapproval_approver', 'sc_req_item', etc.

var sa = new GlideSysAttachment();
sa.copy('sc_req_item', ritm.sys_id, targetTable, targetSysId);