37 lines
1.6 KiB
OpenEdge ABL
37 lines
1.6 KiB
OpenEdge ABL
public with sharing class ProfilePhotoClass {
|
|
@AuraEnabled(cacheable=true)
|
|
public static string ProfilePhotoMethod(String Id){
|
|
try {
|
|
|
|
List<ContentDocumentLink> allRelatedCd=[SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId=:Id ];
|
|
System.debug('allRelatedCd'+allRelatedCd);
|
|
List<ContentDocument> idTitles=new List<ContentDocument>();
|
|
for(ContentDocumentLink cd:allRelatedCd){
|
|
idTitles.add([SELECT Id,Title FROM ContentDocument WHERE Id=:cd.ContentDocumentId]);
|
|
}
|
|
|
|
System.debug('idTitles'+idTitles);
|
|
|
|
List<Id>idofProfile=new List<Id>();//Storing that ids whos title contains Profile
|
|
|
|
for(ContentDocument vb:idTitles){
|
|
if(vb.Title.containsIgnoreCase('Profile')){
|
|
idofProfile.add(vb.Id);
|
|
}
|
|
}
|
|
System.debug('idofProfile'+idofProfile);
|
|
|
|
ContentDocument contentList0=[SELECT Id FROM ContentDocument WHERE Id =:idofProfile ORDER BY CreatedDate DESC LIMIT 1];
|
|
|
|
System.debug('contentList0'+contentList0);
|
|
|
|
ContentVersion cv = [SELECT Id,ContentBodyId FROM ContentVersion WHERE ContentDocumentId = :contentList0.Id];
|
|
System.debug('cv'+cv);
|
|
|
|
return 'https://suprnova-dev-ed.develop.file.force.com/sfc/servlet.shepherd/version/renditionDownload?rendition=ORIGINAL_Jpg&versionId='+cv.Id+'&operationContext=CHATTER&contentId='+cv.ContentBodyId;
|
|
} catch (Exception e) {
|
|
throw new AuraHandledException(e.getMessage());
|
|
}
|
|
|
|
}
|
|
} |