Is there a way to make the url used to render images from visualforce to word dynamic. The problem I am facing is that the URL works in sandbox but on deployment I have to change the url for production.

I tried the following suggestion but this didnt work:

<apex:image url="{!$Site.CurrentSiteUrl}/servlet/servlet.ImageServer?id=0150Y000000ar3v&oid=00D0Y000000LvL1&lastMod=1513157626000" width="240" height="50"/>
  • Take a look at this question from developer forum. – Raul Dec 13 '17 at 11:07

You can create a custom formula field for that object.

Field Name- Instance_URL

API Name- Instance_URL__c

The return type should be 'Text'.

The formula value should be-

LEFT($Api.Enterprise_Server_URL_300, FIND('/services',$Api.Enterprise_Server_URL_300))

Use in your visualforce with {!Object_Name.Instance_URL__c}

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.