Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Workflow email properties

Avatar

Avatar
Level 1
majohns0321
Level 1

Likes

0 likes

Total Posts

4 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
majohns0321
Level 1

Likes

0 likes

Total Posts

4 posts

Correct Reply

0 solutions
View profile
majohns0321
Level 1

27-05-2021

I would like to customize the email template for workflow event notification to include the payload title. Is title exposed in some way to use in workflow emails? From the documentation I can see that the options available are ${payload.data}, ${payload.type}, ${payload.path} -- where can I pull back payload title?

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Give Back 100
Level 10
asutosh_jena
Level 10

Likes

570 likes

Total Posts

687 posts

Correct Reply

197 solutions
Top badges earned
Give Back 100
Boost 500
Affirm 100
Ignite 1
Establish
View profile

Avatar
Give Back 100
Level 10
asutosh_jena
Level 10

Likes

570 likes

Total Posts

687 posts

Correct Reply

197 solutions
Top badges earned
Give Back 100
Boost 500
Affirm 100
Ignite 1
Establish
View profile
asutosh_jena
Level 10

27-05-2021

Hi @majohns0321 

 

You can retrieve the page title in the Workflow model and set it based on the custom template. Please see the code below:

 

Map<String, String> valuesMap = new HashMap<>();
valuesMap.put("Time", Calendar.getInstance().getTime().toString());
valuesMap.put("Step", workItem.getNode().getTitle());
valuesMap.put("Workflow", workItem.getWorkflow().getWorkflowModel().getTitle());
valuesMap.put("Content", workItem.getWorkflowData().getPayload().toString()); // Here I am reading the content and printing on the email, same way you can read any property from payload and send it to template.
StrSubstitutor strSubstitutor = new StrSubstitutor(valuesMap);
HtmlEmail email = createEmail(template, strSubstitutor);
email.setTo(emailRecipients);
this.messageGatewayService.getGateway(HtmlEmail.class).send(email);

 

Now in template read like below:

 

<div style="font-family:Calibri;font-size:11.0pt">
-------------------------------------------------------------------------------------
Time: ${Time}
Step: ${Step}
Workflow: ${Workflow}
-------------------------------------------------------------------------------------
Content: ${Content}
-------------------------------------------------------------------------------------<br/>
This is an automatically generated message. Please do not reply.
</div>

 

Thanks!

Answers (0)