Save DOM Element As Image Attachment In Salesforce3 min read
Did you ever have to capture a screenshot of a widget that displays some financial numbers in tabular format and then email those to a customer? Or maybe copy and paste the snapshot of financial numbers in a proposal document? If yes, in this article, we will see how to automate the process of capturing the snapshot and save it to Salesforce record for later use.
The key steps and gotchas are explained in the following steps are:
The scenario which I came across was to pull data from a Matrix report into a Conga document. Since Conga Composer only supports the Tabular reports, I decided to go with a custom solution to run the report and export report data. Then, I used a Visualforce component to render the data in the same format as that of a Salesforce Matrix report.
Once the report data is rendered in a Visualforce component, capture the DOM element, convert it into a PNG and save that as an Attachment on the Salesforce record as shown in the below snippet.
The saved attachment looks like as below for me:
If you need help with Salesforce or have something a little more complex that might require some advanced developer knowledge? We can help. Contact us at firstname.lastname@example.org or chat with us.
Trust and security are at the top of Salesforce's priority list. The platform has everything you need if you're looking to construct a robust user security paradigm. However, this security approach has flaws that an attacker can exploit to gain access to your data. The Salesforce Architect has the duty to ensure that these features are set up correctly.
March 16, 2022
7 Min Read
Salesforce API limits can stop you from using Salesforce data. Get around that, by using open-source Hasura GraphQL API for Salesforce.
January 12, 2021
3 Min Read