3

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){
Title=att.Id;
pId=att.ParentId;
}

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

//assuming one record is fetched.
c[0].GnD__c=Title;

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? – Daniel Ballinger Jul 12 '15 at 23:38
  • I need that url into a custom field of the detail record.. – hellraizer Jul 13 '15 at 1:45
  • possible duplicate of How to Add snapshot to a custom object record from webcam – Eric Jul 13 '15 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. – hellraizer Jul 13 '15 at 5:11
1

The URL to view the attachment will be something like:

https://c.na5.content.force.com/servlet/servlet.FileDownload?file=00P7000000iz5LF

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

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.