How do we include a chart in an email body?

How do we include a chart in an email body?

  
Hi there,

I have a requirement to send an email daily to managers in our organisation, and the body content of the email must contain a chart showing time worked by each employee team.

When I add a RichWidgets/Chart web block to the Email interface the chart does not display. When the email is sent it does not include any chart information either.

Please could you advise how I can insert a chart into the body of an email that is sent by OutSystems.

Please note that the requirement is that the chart is visible in the email HTML and not as an attachment to the email which requires an additional action to view.

Many thanks,
Rob
Hi Rob,

As an actual HTML in the body I dont think is possible (the charting library uses javascript) and your mail client wouldn't probably run it anyway.

To solve a similar requirement in the past what I did was to create a page that renders the chart and then use another that takes a screenshot of that page and returns the image.

On the email body I used an image with an ExternalUrl that would point to the second page and thus the image would be on the email (not as HTML but as an image).

Hope this helps.

Cheers
Guilherme
Thanks Guilherme,

I appreciate your feedback. I guess it makes sense because of the javascript requirement for the charts. I will try the approach you have used before.

Many thanks.
Kind regards,
Rob
Rob Seagram wrote:
Hi there,

I have a requirement to send an email daily to managers in our organisation, and the body content of the email must contain a chart showing time worked by each employee team.

When I add a RichWidgets/Chart web block to the Email interface the chart does not display. When the email is sent it does not include any chart information either.

Please could you advise how I can insert a chart into the body of an email that is sent by OutSystems.

Please note that the requirement is that the chart is visible in the email HTML and not as an attachment to the email which requires an additional action to view.

Many thanks,
Rob
 A HTML5 chart may work but I am quite doubtful as most of the client have SVG blocked. But still you can check out for HTML5 chart.
 

See if there's a way to output it as an image.

Guilherme Pereira wrote:

Hi Guilherme,

Could you please let me know how did you get the screenshot in another page and save it as an image on the server ? 


Hi Rob,

As an actual HTML in the body I dont think is possible (the charting library uses javascript) and your mail client wouldn't probably run it anyway.

To solve a similar requirement in the past what I did was to create a page that renders the chart and then use another that takes a screenshot of that page and returns the image.

On the email body I used an image with an ExternalUrl that would point to the second page and thus the image would be on the email (not as HTML but as an image).

Hope this helps.

Cheers
Guilherme



Hi Ravi,


The component has a generatepdf and a generateimage. This last one receives a url and returns the binary of the image which you can store on the db and include in your email.


Hope this helps,

Guilherme

Thank you for your response. I am getting Access denied error when trying to generate image.

Hi Ravi,


You're trying in debug mode when you try it in runtime do you get the same error?

You seem to be using a personal environment. What is the url you're using on the generate image?

I recommend you looking at the FAQ and double check your configuration. After that use the FAQ guidance to troubleshoot what the problem might be,


Thanks,

Guilherme