0

I recently turned on the Attachfile() feature within Marketing Cloud (and Public Links is enabled within Salesforce) and have been generating a HTTPS url link in Salesforce for testing. I am using the code below inserting the link I was given in SF:

%%=AttachFile('HTTP','https://myfilename.salesforce.com/fhvXDXoobYchI0Uv1DA5ir7R2Q','testFileName',false)=%%

When testing this, I'm just getting my test email with nothing attached to the email. Any thoughts?

The ampscript is rendering and is sending a test email, I have used 5 different iterations of the logic (just to see if anything would work), and the url provided by Salesforce is able to be accessed off VPN and via Incognito.

Looking at the articles below I feel like I must be close but maybe just need another set of eye's on the process. Any thoughts? Thanks in advance

https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/attachfile.html

5
  • Does it work if you drop the last two parameter values? If you browse to the URL, from say, your personal phone, does the file download? Commented Nov 1, 2022 at 18:37
  • I have also used example 3 found at the bottom of this help document, unfortunately with the same results: ampscript.guide/attachfile Commented Nov 1, 2022 at 18:44
  • @AdamSpriggs dropping the last two parameters, it sends a test email but with nothing attached still. If i browse the URL from phone, or incognito etc, it comes up as an inline PDF with option to download Commented Nov 1, 2022 at 18:49
  • If you browse to it and it doesn't download immediately in your browser, then it may be that the content-disposition at the source isn't correct. You have to link directly to the file. Commented Nov 1, 2022 at 18:54
  • @AdamSpriggs you were correct. Basically in Salesforce it was displaying a URL to DistributionURL on the ContentDistribution object, however I built a query to expose the ContentDownloadURL field, which I think plugged into the ampscript, and it promptly attached the file from SF! Thanks for your help! Commented Nov 1, 2022 at 19:25

1 Answer 1

1

In Salesforce it was displaying a URL to DistributionURL on the ContentDistribution object, however I built a query (In workbench for now, a flow later) to expose the ContentDownloadURL field, which I think plugged into the ampscript, and it promptly attached the file from SF!

Related: https://forcepanda.wordpress.com/2021/05/04/generating-public-url-for-salesforce-files/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .