Badal Khojare
Mega Sage
Mega Sage

1.       With Copy Attachment Action, when I used source record table in Source Attachment Record field it gave me below error: 

image (8).png

 

 

 

 

 

 

 

 

 

 

 

 

This is controlled by a Script Include ‘AttachmentActionErrorHandler’, that says Source Record must be  Attachment table. So in my Flow I changed it to sys_attachment. This is not directly possible as there is no attachment table reference in flow earlier. So, I added a Lookup Action on attachment table and then used the reference in next step. 

 

image (9).png

 

 

 

 

 

 

 

 

 

 

 

 

2.       Now my Flow got executed without error as seen below but the attachment that I was getting on my Change Record was not the one I attached on my RITM. 

 image (10).png

   3.   So I checked the Execution details, and in the Get Attachments on Record Action I got the correct attachment from source. 

 image (11).png



4. 

    In the next Action, Lookup Record, I was getting a different attachment. 

image (12).png

5. And the same attachment was getting copied to the target record. 
image (13).png


 

 

6. This was because in the Lookup Attachment Record, it returns the first record it finds based on the given condition.  

image (14).png

7. So I added few conditions to the Lookup Attachment Record Action 

image (15).png
 

8. Now it takes the Source attachment from the RITM and copies it to my Target record, as shown below.

 image (16).png

image (17).png

image (18).png
 

 9. As of now the attachment is attached from a variable so it only takes one attachment, but if there are multiple attachments to be copied I have added ‘For Each’ Flow so it takes all the attachments and copies it to target record. 

image (19).png


 
Comments
Aaron Loughran
Tera Expert

Thank you for the article @Badal Khojare this helped me get started on this.  The multiple attachments threw me as it was not initially working.  I ended up using the Look Up Records function for the sys_attachment table, with a condition of the Table Sys ID is the Sys ID of the original record housing the attachments:

Screen Shot 2024-05-31 at 2.20.03 PM.png

Then added a For Each function to identify each attachment record it found:

Screen Shot 2024-05-31 at 2.20.14 PM.png

Then after the For Each I used the Copy Attachment function:

Screen Shot 2024-05-31 at 2.20.23 PM.png

And that allowed for multiple attachments to be copied over successfully from the RITM record to the INC record.

 

I have tested this once so far and it was successful!

KennethArtL
Tera Contributor

Hello @Badal Khojare and @Aaron Loughran 

I've implemented your solution but I was wondering if there's a way to validate if the file has been already attached to the RITM before making this actions that you shared.

A brief context: I have a service which the file is required to attach to RITM but randomly there are times when the file doesn't get attached from the request submited. 

 

I already tried with the Get attachment action but as you can notice, it only gets de id from the list of attachments and not the current attachment

GET: 

KennethArtL_2-1722266594272.png

 

IF:

This is where I want to validate that there's no file but it reads the value from the Get (which is from list) as true and it doesn't proceed to the function that you provided

KennethArtL_3-1722266741627.png

 

 

I appreciate your attention and thank you in advance

Version history
Last update:
‎09-21-2023 02:18 AM
Updated by:
Contributors