I am trying to add a dynamic link in a visualforce email template to download a PDF which is stored as a publicly available Static Resource:

<a href="https://x.cs.force.com/site/{!URLFOR(relatedTo.Static_Resource_Name__c)}">Download PDF</a>

But it doesn't generate a valid URL:



  1. Is it possible to set URLFOR dynamically?
  2. How can I create a link which has a dynamically generated link to different static resources?

It's possible with this URL:

<a href="https://x.cs.force.com/site/resource/{!relatedTo.Static_Resource_Name__c}">Download PDF</a>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.