Workflow: Assigned Task, what variable is the user who created the task?


I’ve created a nice workflow email it’s very pretty, ok well it isn’t but it’s different to the default one telling you that it’s been allocated and with a bit more information.

I am stuck on one last thing, what is the $… for the person that created the task for you? So I want to say the task was assigned to you by… $… and i’m stumped over what that is.

Tried $task_created_user_name and similar all just guessing… But does anyone know if there is a variable for who created the task that I can add in here?


The variable name you want is ‘created_by_name’ but I don’t think it will work by default. You will need to make a small code adjustment for this to work.

If you look in : modules/EmailTemplates/EmailTemplate.php you will see an array called $badFields and this lists all the fields that don’t normally make sense in an email template.

What you need to do is copy this array to the custom version of EmailTemplate.php at: custom/modules/EmailTemplates/EmailTemplate.php. Paste it near the start after the $event variable. Then remove ‘created_by_name’ from the array.

Do a quick repair and rebuild and the ‘created_by_name’ variable should now show up for use in the email template.

1 Like


I can now add the below line to the email and it works great:-

This task has been created by $ task_created_by_name and assigned to you.


Further to this… It’s awesome but now users are asking how to see who crated the original task within Tasks. So when you click on the task to show who created the task and I’m not sure how to do this. Would I add a relate field to users and be able to select them from under there.

So no-one wants to have to add anything when creating the tasks but the user who receives the task would like to see who sent it to them, they can in the email because of above, but not in the actual task itself.


This has broken in 7.7.x any ideas on how I can fix this?

I have checked and the custom field is the same as when I changed it last February. But since we upgraded to 7.7 the field does not work.

$ task_created_by 1b72064c-79da-a56b-a8e0-5630e36f0a74

$ task_created_by_name:

So task_created_by shows the ID I guess of the user? But when I do with name so task_created_by_name it just comes back Blank as if it’s not managing to convert / show the name.

Any help would be greatly appreciated Our users used this a lot.