5

I am trying to create a template that reports on the user record details. However I run into an issue when I create an email alert form a workflow that is triggered when a new user record is created. I want to pass the user details through to the template, however the template display the user details of the running user of the workflow. Is there a way around this?

2
  • Can you share the template you have been trying to use? Commented Apr 22, 2015 at 8:40
  • no need, I found the answer and posted it below.
    – Bartley
    Commented Apr 22, 2015 at 8:52

2 Answers 2

6

To reference the target user record, I should use {!Target_User.[FIELD]} where [FIELD] is the field name. Link

Workflow reference to target user

1

It is worth to consider setting up a trigger on your object and send an email from within it. This way you can parse the template on your own in Apex, like:

string subject = template.Subject;
string body = template.HtmlValue;

subject = subject.replace('{my_tag}', 'my value');
body = body.replace('{another_tag}', 'some value');
1
  • 3
    slightly too complex a solution for what we need. I always try to build in Salesforce through point and click rather than code but thanks for your answer.
    – Bartley
    Commented Apr 22, 2015 at 8:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .