0

I am using a visual force template. I can put the origin server in the email by doing:

{!LEFT($Api.Partner_Server_URL_140, FIND(".com/",$Api.Partner_Server_URL_140)+3)}

and when I an email sent I'll see:

https://na11-api.salesforce.com

However, when I try to use this in a URL which pulls in an image, I do:

<img src= "{!LEFT($Api.Partner_Server_URL_140, FIND(".com/",$Api.Partner_Server_URL_140)+3)}/servlet/servlet.ImageServer?id=015G0000001f7xo&oid=00DG0000000gUxRMAU" height="90"/>

I get:

Error:      VFTemplate1 line 13, column 154: The reference to entity "oid" must end with the ';' delimiter  
Error   Error: The reference to entity "oid" must end with the ';' delimiter.

So I try escaping the " " characters around the com by doing:

<img src= "{!LEFT($Api.Partner_Server_URL_140, FIND(\".com/\",$Api.Partner_Server_URL_140)+3)}/servlet/servlet.ImageServer?id=015G0000001f7xo&oid=00DG0000000gUxRMAU" height="90"/>

And, I get same error. Any ideas?

Thanks.

4
  • Do you need the salesforce base URL rather than the API URL? Nov 22, 2012 at 11:11
  • @techrekker From my testing either work. but if it is easier to get the base URL, and it works I'd go for that.
    – dublintech
    Nov 22, 2012 at 11:14
  • 1
    Seems like the error is to do with URL encoding. Have you tried using the URLFOR function within an apex:image which could work better salesforcesource.blogspot.co.uk/2008/12/… Nov 22, 2012 at 11:30
  • @techrekker good idea but that API is usually used with static resource. I am sending an email and the general advice is to make your image a document rather than a static resource when doing that.
    – dublintech
    Nov 22, 2012 at 11:55

1 Answer 1

0

Fixed by hanging the " to ' around some of the parsing.:

<img src= "{!LEFT($Api.Partner_Server_URL_140, FIND('.com/',$Api.Partner_Server_URL_140)+3)}/servlet/servlet.ImageServer?id=015G0000001f7xo&oid=00DG0000000gUxRMAU" height="90"/>

Works with img and apex:image

You must log in to answer this question.

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