Advertisement
Guest User

attach

a guest
Oct 14th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. Public Class downloadAttachment {
  2.  
  3. String recId;
  4.  
  5. public downloadAttachment(ApexPages.StandardController controller) {
  6. recId = controller.getId();
  7. }
  8.  
  9. public List<String> getfieldId() {
  10. List<String> li = new List<String>();
  11. System.debug(li.isEmpty()); // true
  12. List<Attachment> attachedFiles = [select Id from Attachment where parentId =:recId order By LastModifiedDate DESC ];
  13. if( attachedFiles != null && attachedFiles.size() > 0 ) {
  14. for (Integer i=0 ; i < attachedFiles.size(); i++) {
  15.  
  16. fieldId.add(attachedFiles[i].Id);
  17. }
  18. }
  19. return fieldId;
  20.  
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement