Add case number to case assignment email

I’m trying to add the case number to the email that is generated on case assignment.
I created a custom email template file custom/include/language/en_us.notify_template.html, but don’t know how to refer to the case number.
I tried {CASE_NUMBER} and {CASE_CASE_NUMBER} and neither worked. I have no idea where to find the variables allowed, and what case_number would be called.

Thanks for any help

Searching the code I see a variable called


There seems to be a leading “a” in some places, but not in others. Strange…

Other things to try


I don’t have time to check, but if you go into Email templates you can play with variable names, and you should be able to get a full list.

which version are you using, what is your environment?

he’s referring to the notification mail on user assignment, that’s handled by the notify template, you’re in the correct path but you need to modify the /modules/Cases/Case.php specifically the function set_notification_body($xtpl, $case) you need to add the case_number xtpl there variable, remember to copy this file and modify it in the custom folder

best regards

1 Like

Mike do you want to create a simple PR adding this into the code? It feels like an obvious thing that would benefit more people.

Thanks :slight_smile:

Version 7.9.7
Sugar Version 6.5.25 (Build 344)

Per @mikebeck I added one line to: public function set_notification_body($xtpl, $case)

    $xtpl->assign('CASE_NUMBER', $case->case_number);

and can get the value as {CASE_NIUMBER} in the modified subject line

Real easy if you know where to look!

Thank you for your help

Months later, I stumbled upon this again and decided to make a simple PR: