How to avoid hard coding of instance name like NA12 for the documents images in Salesforce?

Use domain URL.

Check the below example

Old URL - https://YOURDOMAIN--c.na35.content.force.com/servlet/servlet.ImageServer?id=01541000001xGHi&oid=YOURORDID
New URL - https://YOURDOMAIN.my.salesforce.com/servlet/servlet.FileDownload?file=01541000001xGHi

No comments:

Post a Comment