Symptoms
I have a workflow in which an activity (Responsible Manager - Closure) can be accessed from 2 others activities (Customer - Closure and Project Controller - Delivery).
At the moment the 'Assign Project or WR Code' event under the Responsible Manager - Closure activity has one specific email template that the Responsible Manager will always receive.
What I would like to achieve is that, depending on the preceding activity, I would like the Responsible Manager to receive a different email.
For example, if it's coming from the Project Controller I would like the email to say "Congratulations on the approval of your Work Request" while if it's coming from the Customer - Closure I want the email to say "The closure of your Work Request has been rejected by the customer".
Is that achievable without having to create a brand new activity (like Responsible Manager - Resubmit Closure)?
Diagnoses
This is possible by using Data Fields to store the Line data surfaced through the Action.
You can then use expressions in the email body to determine what to show.
Resolution
The basic setup is as follows:
Data fields:
In the object browser, go to Process/Activity Data -> Data Fields ->
Right click and select 'add'.
Add a data field for each email and fill in the email (emailCustomerCLosure, EmailProjectController)
Add a data field for each line, to store a text string of the line for comparison (parCustomerClosure, parProjectController)
Add a data field to store the selected line (parSelectedLine(keep blank)).
Store selected line:
On each activity, after the client event, drop in a data event.
Use this data event to store Process/Activity Data -> Data Fields -> DefaultActivity -> Action result into the selected line data field
Send email:
In the email message, go to function browser -> Logical and drag in an If condition.
For the condition, drag in a Contains function
Text = selected line
Substring = parProjectController
True Value = EmailProjectController
False Value = EmailCustomerClosure
So now, if the path comes from 'Project Controller', that corresponding message will appear.
Otherwise the 'Customer Closure' message will appear.
You can tweak the logic to better fit your scenario.
You can also substitute data fields for expressions.