Share Utils Methods

The SharinPix package provides the Apex class, ShareUtils , which includes methods that can be applied when sharing albums or images from Salesforce.

circle-exclamation

Share Utils Example

generateUrl

global static String generateUrl(String recordId, String permissionIdOrName)

  • This method can be used to share a complete album with specific abilities.

  • In the below code, “permission” is the name or ID of a SharinPix Permission.

String url = sharinpix.ShareUtils.generateUrl('0018a00001rL2scAAC', 'permission');
System.debug('shareable url: ' + url);

Note: For more information on how to create/edit the custom permission, refer to this article: SharinPix Permission object - How to create and assign custom permission?

generateUrl

global static String generateUrl(String recordId, String permissionIdOrName, List<ShareImageInfos> imageInfos, Map<String, Object> params)

  • This method can be used to share certain images of an album with specific abilities.

String url = sharinpix.ShareUtils.generateUrl('0018a00001rL2scAAC', 'permission', _imageInfos_ , _params_);
System.debug('shareable url: ' + url);

Note: imageInfos and params are explained below.

Parameters

imageInfos

  • imageInfos should be in the format below:

List<sharinpix.ShareImageInfos> imageInfos = new List<sharinpix.ShareImageInfos> { new sharinpix.ShareImageInfos('imageId', index)};

The index should be set only if the order of the images displayed is to be predefined. In addition to index, the params key orderByIndex should be set to true as explained below.

params

  • The params value should be an Apex Map. The possible keys in it are:

    • orderByIndex (Boolean): set to true to maintain the order of the images according to their “index” values. If set to true, any sort field or direction on the SharinPix Permission is overridden. If set to false, the behaviour will default to the SharinPix Permission’s sort field or the application default.

triangle-exclamation

Last updated

Was this helpful?