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
Shannon FosterShannon Foster 

Create Attachment with Body being URL Address

Hello All!
I am trying to create an attachment using microsoft flow builder. I have a flow builder that triggers on a form submit. Once triggered, the flow creates an opportunity in Salesforce and then passes the Record ID to the next step which is creating an attachment and using the Record ID from the previous step as the Parent ID. Everything works correctly except that I am unable to download the PDF from the attachment. I am trying to pass a URL in the body of the attachment. It is converted to Base64 when submitted to Salesforce as required. When I paste the URL into google chrome it automatically downloads a PDF. However when I try and open the attachment I receive the following message, Failed to load PDF. Can someone let me know if what I am trying to do is possible or if it is not possible to pass a URL and have Salesforce download it as PDF.

Thank You for any help. Please let me know if I can provide any additional information. I have tried to open a ticket with Salesforce but they were unable to help me. 

Here is the code snippet from the image below.
{
"Name": "test.pdf",
"Body": "aHR0cHM6Ly9zZXJ2aWNlcy5jb2duaXRvZm9ybXMuY29tL2QvVlVMMS1LQ0l1VW11bkpGNWllc0xrZz9jb2RlPVZxdHdpWlNYNE5hcGdPT1daR1VjQWZ4bzB6NjdtSFpKYlUzb09RcUJzMm8k",
"ParentId": "a0N1L00000ZrcFEUAZ",
"ContentType": "application/pdf"
}

The body decoded from base 64 is: 
https://services.cognitoforms.com/d/VUL1-KCIuUmunJF5iesLkg?code=VqtwiZSX4NapgOOWZGUcAfxo0z67mHZJbU3oOQqBs2o$

User-added image

User-added image
User-added image

User-added image
Best Answer chosen by Shannon Foster
Shannon FosterShannon Foster

I received support from my form builder company and they advised me to use an HTTP get request and then post the body of the HTTP get as the body for the attachment. This fixed my issue. Posting for other users. 

 

Thank You,
 

All Answers

Shannon FosterShannon Foster
Let me clarify, I am able to go to the URL in google Chrome and it will allow me to download and open the PDF. I am just unable to open it from Salesforce attachment.
Shannon FosterShannon Foster

I received support from my form builder company and they advised me to use an HTTP get request and then post the body of the HTTP get as the body for the attachment. This fixed my issue. Posting for other users. 

 

Thank You,
 

This was selected as the best answer