function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
ContentDistribution newItem = new ContentDistribution(); newItem.Name = 'profile Photo'+con.firstName; newItem.ContentVersionId =your attachment version id; newItem.PreferencesAllowViewInBrowser= true; newItem.PreferencesLinkLatestVersion=true; newItem.PreferencesNotifyOnVisit=false; newItem.PreferencesPasswordRequired=false; newItem.PreferencesAllowOriginalDownload= true; Insert NewItem;
select ID,DistributionPublicUrl,ContentVersionId, ContentDownloadURL from ContentDistribution where ContentVersionId in:VersionIds
Create ContentDistribution for your attachment and onces it's create use DistributionPublicUrl
https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/api/sforce_api_objects_contentdistribution.htm
https://developer.salesforce.com/docs/atlas.en-us.sfFieldRef.meta/sfFieldRef/salesforce_field_reference_ContentDistribution.htm
then query for it
I hope you find the above solution helpful. If it does mark as best answer to help others too.
Thanks,
Ramesh D