Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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.

share|improve this question
    
Do you need the salesforce base URL rather than the API URL? –  techtrekker Nov 22 '12 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 '12 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/… –  techtrekker Nov 22 '12 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 '12 at 11:55
add comment

1 Answer 1

up vote 0 down vote accepted

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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