You need to sign in to do that
Don't have an account?

In traihead showing error
@AuraEnabled
public static void updatePicturePath(String recId){
//In Lightning Experience, Attachments are stored in ContentDocuments
ContentDocumentLink docLink = [ SELECT ContentDocumentId
FROM ContentDocumentLink
WHERE LinkedEntityId = :recId order by Id desc Limit 1];
//ContentVersion Id uniquely identifies the attachment
ContentVersion ver = [SELECT Id FROM ContentVersion Where ContentDocumentId = :docLink.ContentDocumentId];
//Update the Picture_Path field with the url of the image
Speaker__c speaker = [SELECT Id FROM Speaker__c WHERE Id = :recId];
speaker.Picture_Path__c = '/sfc/servlet.shepherd/version/download/'+ ver.Id;
upsert speaker;
}
====================================
Unexpected token 'void'.
public static void updatePicturePath(String recId){
//In Lightning Experience, Attachments are stored in ContentDocuments
ContentDocumentLink docLink = [ SELECT ContentDocumentId
FROM ContentDocumentLink
WHERE LinkedEntityId = :recId order by Id desc Limit 1];
//ContentVersion Id uniquely identifies the attachment
ContentVersion ver = [SELECT Id FROM ContentVersion Where ContentDocumentId = :docLink.ContentDocumentId];
//Update the Picture_Path field with the url of the image
Speaker__c speaker = [SELECT Id FROM Speaker__c WHERE Id = :recId];
speaker.Picture_Path__c = '/sfc/servlet.shepherd/version/download/'+ ver.Id;
upsert speaker;
}
====================================
Unexpected token 'void'.
Cna you try below code which will work as I already tested in my own org.
All Answers
Cna you try below code which will work as I already tested in my own org.