Aurora_Gaimon

CA PPM: Send HTML email with GEL

Blog Post created by Aurora_Gaimon Employee on Jan 18, 2017

Many times we all wished we could configure action items notifications with hyperlinks, or different font types, colors, sizes. Or for any other reason, we may decide to create a GEL script to send an email instead a notification or action item from a process.

 

How do you send HTML emails?

 

Create a simple test gel script to start with. Get some data using queries and set values in variables. 

See below the ones used in my sample:

 

${v_full_name} = Aurora Gaimon
${v_project_code} = PRJ_01234
${v_project_name} = Test Project
${v_url_feedback} = an URL

 

In that example I will not explain how to query data and set values. So, let's go to the point . I've snipped the part where the HTML email is actually coded.

 

[...]
<!-- Send HTML email-->
<gel:email from="do-not-reply@dummy.com"
fromName="Do not reply"
subject="This is a test for '[${v_project_code}] - ${v_project_name}' "
to="test_user@dummy.com">

<![CDATA[
<html>
<body>

<p>Dear]]>${v_full_name}<![CDATA[,</p>
<p> </p>
<p>Please be informed that this is a test email for Project: <strong>]]>${v_project_code}<![CDATA[</strong>, which has been submitted.</p>
<p>As you have been indicated as a key participant for this project, please provide your feedback by selecting <strong>Option 1/ Option 2 / Option 3</strong> and add comments in the text area.</p>
<p> </p>
<p>Click here:<a href="]]>${v_url_feedback}<![CDATA[">Feedback</a></p>

<p> </p>
<p>Thank you in advance,</p>
<p>CA PPM Team</p>
</body>
</html>
]]>
</gel:email>

[...]

 

Output:

 

Important remarks:

  • Ensure library xmlns:mail="jelly:email"  is included at the beginning of your script.
  • For OnDemand environments, sender must be: do-not-reply-ondemand@ca.com  
  • Body content (text) needs to be always without right alignments or margins/indents. Otherwise, you will see it also in the text email itself.
  • Use <![CDATA[   ]]> to escape gel code.
  • You can parse variables. Ensure they are not included inside <![CDATA[   ]]> or it will be treated as "text" instead of "gel code"
  • Use HTML tags for formatting.

 

** Note: you should NEVER hard code smtp details in you GEL scripts.

 

 

If you need help with process/gel scripting, engage CA Services or ask questions in CA Communities. 

That’s all. Thanks for reading until here. Did you like it? Please, don’t be shy and share it.

Outcomes