1

I am trying to send specific dashboard components in regularly programmed html emails, and doing some basic reading suggests this certainly isn't an overtly offered feature by Salesforce (yet) but I was wondering if any one had any workarounds?

Right now, these components are tied to standard dashboards (no visualforce pages, nothing fancy).

I noticed each component can be opened in a separate tab as a PNG, is there someway to create a visualforce page that flattens the latest refreshed Component into a PNG and then links that back into an HTML/VF email?

(I am open to easier solutions as well!)

Note: I am aware of course of the 'Refresh and Send' option Salesforce provides, however I would like to send specific components in a template that I can control (and more mobile-optimized)

Edit: Regarding the PNG comment, all I was referring to is the ability to open each component as a PNG in a separate tab (right click -> 'Open Image in New tab') which suggests that some kind of 'PNG storage' at least for non-table components is possible

2

I don't know if you're aware, but Visualforce dashboard components can't be sent using the Salesforce "Refresh and Send" option you've mentioned because of limitations surrounding them. I only mention that because it might tell you something about the potential difficulties involved in what you're asking about.

I'm not aware of the method you speak of to open a dashboard component in a separate tab as a PNG, but also haven't researched it (can you provide a link to a reference?). But, if you can do that, you could potentially approach this in several different ways.

Depending on the form you have them in, you could take all of the PNGs in the tabbed pages and link them to a single page where you could then display them. Without retrieving the actual image, I think you'd find it "awkward" at best and unappealing to attempt to display the content of tabbed pages within another HTML page.

With that having been said, regardless of how you created that page, I think you'd still need to render it as a PDF to send the page's content as an email attachment. There may be difficulties using "renderAsPDF" if the images are linked from a servlet or if they're blobs.

If you do indeed have the actual PNG images available to you in a form that you can embed within an email, then you could create a template to use them with. I think this approach would have the greatest potential for success. It would be a matter of creating a controller that retrieves your images from the tabbed dashboard component, places them in your email template and then sends the email to the recipients.

More than anything, I suspect that security restrictions surrounding dashboard components will likely be the biggest issue you'll encounter should you try what you propose. If you don't operate in system mode, you may not have access to the components. Yet, if you do this in system mode, users could wind up receiving emails with dashboard components they're not supposed to view.

  • Thanks for the brainstorming. Presumably a visualforce page could 'flatten' each Component into a PNG and if the Visualforce page's security was lax, that issue should be a resolved, correct? – GPP Dec 13 '15 at 19:04
  • 1
    No, I wouldn't say it could be done through the page or a component. It would need to be done via a controller that explicitly used the without sharing keywords. The controller would need to retrieve the source PNG files, bypassing the sharing that would normally be on them, then 'feed' them into the Visualforce page or template. – crmprogdev Dec 13 '15 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.