Guest User

Untitled

a guest
Jan 19th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. for(object__c conv: database.query(query)){
  2. List <Attachment> attachmentList = [SELECT Id, Name, ContentType, ParentId FROM Attachment WHERE ParentId = :conv.Id limit 1];
  3. if (attachmentList.size() > 0){
  4. Attachment att = attachmentList[0];
  5. row.AttachmentId = att.Id;
  6. row.AttachmentName = att.Name;
  7. row.AttachmentType = att.ContentType;
  8. }
  9.  
  10. list <Attachment> attachmentList = [select Id, Name, ParentId from Attachment];
  11. for(object__c conv: database.query(query)){
  12. for (Attachment att : attachmentList){
  13. if (conv.Id == att.ParentId){
  14. row.AttachmentId = att.Id;
  15. row.AttachmentName = att.Name;
  16. row.AttachmentType = att.ContentType;
  17. }
  18. }
Add Comment
Please, Sign In to add comment