I am capturing image from webcam and storing the image in record attachment by a managed package app. I have a text field in record detail page path__C where i need to capture inserted image (in attachment) path url. Can anyone help me in that.

I have tried writing down the trigger. I need a small help in this. Below is my trigger . In this i want to filter out those attachments whose name is 'Default.png' and then update. Please help.

trigger SetIdToAttachment on Attachment (after insert) {
String Title;
Id pId;

for(Attachment att: trigger.new){

List<Devotee_Details__c> c=[select Id , GnD__c from Devotee_Details__c where Id=:pId];

//assuming one record is fetched.

update c[0];

  • What do you mean by "i need to capture inserted image (in attachment) path url"? Do you want a URL to view the attachment you just created? Jul 12, 2015 at 23:38
  • I need that url into a custom field of the detail record.. Jul 13, 2015 at 1:45
  • possible duplicate of How to Add snapshot to a custom object record from webcam
    – Eric
    Jul 13, 2015 at 2:12
  • No Eric..tht part I covered it with a AppExchange app. After the image is captured I want the url of the attachment in a custom field of the record. Jul 13, 2015 at 5:11

1 Answer 1


The URL to view the attachment will be something like:


You will need to swap out the na5 instance for your current pod identifier. The attachment Id will also need to be changed from 00P7000000iz5LF

If you want to use a Forumla to display the attachment image, consider using the IMAGE function. See Sample Image Link Formulas

You must log in to answer this question.

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