function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Display Attachment image in formula field

Hi All,

I have a trigger which updates attachment id into a custom field of object X__c. I have creatted a formula field with below formula to display the attached pic 

IMAGE('/servlet/servlet.FileDownload?file=customfield__c', customfield__c ,20,20).

But the image is not getting displayed.But if i replace the customfield__c with recordid like below , the image is getting displayed. Please help where i am going wrong.

IMAGE('/servlet/servlet.FileDownload?file=00P28000000Ezg4', customfield__c ,20,20).



Modify your formula like 

IMAGE('/servlet/servlet.FileDownload?file=' + {!customfield__c}, customfield__c ,20,20).

IMAGE('/servlet/servlet.FileDownload?file={!customfield__c}', customfield__c ,20,20).

Hope anyone in these two will work.

Rahul SharmaRahul Sharma
I think you are using this in formula and hence do not need merge fields, If above is not working then try this:
IMAGE('/servlet/servlet.FileDownload?file=' + customfield__c, customfield__c ,20,20)
Money Care 7Money Care 7
Hi Rahul
IMAGE('/servlet/servlet.FileDownload?file=' + customfield__c, customfield__c ,20,20)

what is customfield__c here

Rahul SharmaRahul Sharma
customfield__c was holding Id of attachment as mentioned by original poster.
Money Care 7Money Care 7
Hi Rahul Could u share the trigger for updating the attachmnetid in custom field of custom object ?