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?

  • Can you share the template you have been trying to use? – Robin De Bondt Apr 22 '15 at 8:40
  • no need, I found the answer and posted it below. – Bart Apr 22 '15 at 8:52
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');
  • 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. – Bart Apr 22 '15 at 8:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.