The CreatorCon Call for Content is officially open! Get started here.

How to lookup attachments on multiple records, and for each, attach to new records in Flow Designer?

Aki18
Tera Contributor

I'm creating a Flow to achieve the followings. Could someone please advise me on how to implement this in Flow Designer?

 

1. Lookup multiple records for Table-A with some filter condition.

2. For each record in Table-A, create new records in Table-B based on some field values of Table-A.

3. When creating each record in Table-B, add attachments retrieved from each record in Table-A.

Aki18_1-1665676913004.png

Best Regards,

Aki

1 ACCEPTED SOLUTION

Muhammad Khan
Mega Sage

Below approach might help you fulfill your requirement.

 

First create a custom action which takes 2-inputs (Table A record sys_id, Table B record sys_id). Create a script step to copy attachments. In your script step utilize 

GlideSysAttachment.copy('<Table_A_Backend_Name>', inputs.<Table_A_Record_SysID>, 'Table_B_Backend_Name', inputs.Table_B_Record_SysID);

Then try utilizing below steps.

  1. Use Look Up Records action on Table A.
  2. Use For Each Flow Logic to iterate through each record found from Table A
    1. Use Create a Record action to create records in Table B.
    2. Use Custom Action which you created above to copy attachments from Table A record to Table B record. Make sure to pass the records sys_ids.

View solution in original post

1 REPLY 1

Muhammad Khan
Mega Sage

Below approach might help you fulfill your requirement.

 

First create a custom action which takes 2-inputs (Table A record sys_id, Table B record sys_id). Create a script step to copy attachments. In your script step utilize 

GlideSysAttachment.copy('<Table_A_Backend_Name>', inputs.<Table_A_Record_SysID>, 'Table_B_Backend_Name', inputs.Table_B_Record_SysID);

Then try utilizing below steps.

  1. Use Look Up Records action on Table A.
  2. Use For Each Flow Logic to iterate through each record found from Table A
    1. Use Create a Record action to create records in Table B.
    2. Use Custom Action which you created above to copy attachments from Table A record to Table B record. Make sure to pass the records sys_ids.