You need to sign in to do that
Don't have an account?
sasham
Public link for the image file that is already saved in salesforce file using Apex
Hi Anybody can help on this
Created custom lightining component and uploded image (Using Apex code )
ContentVersion Ver = new ContentVersion();
Ver .ContentLocation = 'S';
Ver.PathOnClient = 'x.png';
Ver.Title = fileName; // Display name of the files
Ver .VersionData = EncodingUtil.base64Decode(base64Data);
Ver .isMajorVersion = false;
insert Ver ;
And then
Id conDocId = [SELECT ContentDocumentId FROM ContentVersion WHERE Id =:Ver.Id].ContentDocumentId;
ContentDocumentLink doc = new ContentDocumentLink();
doc.ContentDocumentId = conDocId;
doc.LinkedEntityId = parentId;
doc.Visibility = 'AllUsers';
doc].ShareType = 'V';
insert doc
After uploaded, I need get this image link (which is public) by quering for this image. Note that many images have been uploaded to the same record.
Created custom lightining component and uploded image (Using Apex code )
ContentVersion Ver = new ContentVersion();
Ver .ContentLocation = 'S';
Ver.PathOnClient = 'x.png';
Ver.Title = fileName; // Display name of the files
Ver .VersionData = EncodingUtil.base64Decode(base64Data);
Ver .isMajorVersion = false;
insert Ver ;
And then
Id conDocId = [SELECT ContentDocumentId FROM ContentVersion WHERE Id =:Ver.Id].ContentDocumentId;
ContentDocumentLink doc = new ContentDocumentLink();
doc.ContentDocumentId = conDocId;
doc.LinkedEntityId = parentId;
doc.Visibility = 'AllUsers';
doc].ShareType = 'V';
insert doc
After uploaded, I need get this image link (which is public) by quering for this image. Note that many images have been uploaded to the same record.