I use nodejs/jsforce to connect to Sf API.

In the "Contacts" one of the fields is retrieved as a string path


But that's not very handy if I want to display the actual image. I would expect smth like mysite.com/.../myimage.jpg

If I login to SF and open this contact detail there is a correct full absolut image url mysite.com/.../myimage.jpg So question is there a specific setting of jsforce plugin or Sf API itself to get full url ?

I've checked this question - How to get url for facebook profile photo in contact - but I not sure how to apply this in case with jSForce API access?


You can try to create the full URL in this way. After the login API call or OAuth2 authorization, you can get Salesforce access token and its instance URL. Use this URL in conjunction with PhotoUrl (instanceURL+PhotoUrl) to create the full contact Image URL.

  • I've tried this. but I only have following props there - { id: '005o0000....', organizationId: '005o0000....', url: 'https://login.salesforce.com/...'} does it mean that I need to fill in the instanceUrl field somewhere in SF admin UI ? – shershen Jun 12 '17 at 13:27
  • No, you should receive it automatically in the response after the login call. As per JsForce documentation, you should get it as conn.instanceUrl jsforce.github.io/document – Saroj Bera Jun 12 '17 at 13:41
  • Yes I see this part of the doc, but if it's not there? However the connection itself in my case is OK - I can execute queries normally. What that conn.instanceUrl missing may mean - wrong access level or wrongly configured Sf ? – shershen Jun 12 '17 at 13:44
  • Sorry, do you have any idea how to get the instanceUrl ? Or why It may be not visible ? – shershen Jun 12 '17 at 18:42

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.