function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Chris LamChris Lam 

Visual Worklfow - Issuing with copying email attachment to new email

I am trying to create a flow that can duplicate an email message including attachment onto a new case from an existing case that has been closed.
So far I have been able to create the flow as attached, which create a new case from existing case as well as copying the email message over, however it doesn't seems to copy the attachment over and the flow ran without issue.  Does any one know what I have done wrong? I would like to copy the whole email including attachment from the last email in the old case into the new case.  While the email has been copied over, the attachment didn't get created under the new email or case.

1) Part of the Flow
User-added image
2) Fast Lookup on Email attachment from the Email ID from the closed case.

3) Loop thru the list of attachments
User-added image
4) Assigning the SOObject variabe (var_CurrentAttachment) to the new SOObject variable NewAttachment, including the new email message ID as the parentID of the attachment.
User-added image
5) Adding each of the NewAttachment SOObject variable to the NewAttachmentCollection SOObject Collection variable (cater for multiple attachments)
User-added image
6) Fast Create an attachment using SOObject collection variable NewAttachmentCollection. 
Case and Email are both successfully created however attachment is not in the email created on the new case. Can you tell me what I have done wrong in this Visual Flow?
User-added image
NagendraNagendra (Salesforce Developers) 
Hi Chris,

According to your flow, when you are creating New Case store that Case Id into a variable say var_caseId.
That var_caseId to be assigned as Parent of the newly created Attachment record.

Apparently looking at the flow in this step you are wrongly assigning the ParentId to {!var_NewEmailId}. It should be like this to{!var_caseId}.

(4) Assigning the SOObject variable (var_CurrentAttachment) to the new SOObject variable NewAttachment, including the new email message ID as the parentID of the attachment.
User-added image
Hope this helps.

Mark it as solved if it's resolved.

Thanks,
Nagendra.
 
Chris LamChris Lam
Hi Nagendra, thank you for the input, am I able to store the new attachment under the new email by using the var_NewEmailId?  The purpose of this whole flow is to create a new case together with the last email message (plus attachment) if an existing closed case has been responded to.  Hence preferably the attachment should be created under the cloned email.

While my flow works well so far in creating a new case and cloing the last email, it fails to clone the attachment over to the new email.
Chris LamChris Lam
Just updated the flow to the below but the attachment is still not populating in the new case.User-added image