Your personalized command
SharinPix allows for personalized commands, in other words you can perform your custom actions on selected images.
This article's code can be easily deployed to your org from this URL.
In this article we will be setting up a Visual Force page on Salesforce with a custom action "Send Email"
Add the SharinPix Visualforce component in your Visualforce page using the code snippet below:
<SharinPix:SharinPix height="500px" parameters="{! parameters }"/>Once done, ensure your "apex:page" has an extension apex class with a "parameters" as follows
Map<String, Object> params = new Map<String, Object> {
'Id' => stdCtrl.getId(),
'abilities' => new Map<String, Object> {
stdCtrl.getId() => new Map<String, Object> {
'Access' => new Map<String, Object> {
'see' => true,
'image_list' => true,
'image_upload' => true,
'image_delete' => true,
'image_crop' => true,
'image_rotate' => true
},
/*******************************************/
/* ADD CUSTOM ACTIONS IN THE `Actions` KEY */
/*******************************************/
'Actions' => new List<String> {
'Send an email'
}
}
}
};
parameters = JSON.serialize(params);The above code will add the "Send an email" action to the SharinPix widget. Now we need to listen when the action is fired.
Add the following script to your Visual Force page.
At this point, we need to send a request to the server (Apex Class) to send the email with the following pictures in the body.
Above we invoked a remote apex action. Now we will need to perform the send email action in the apex controller.
The above apex remote action, send an email with the selected picture's thumbnail to the Contact on which the Visualforce page is on.
Below is a glimpse of the end result.

End result email:

Last updated

