Email template question?

Hi. I wondering how to edit standard email template for Task module. To addon Account_name and other fields, how is this possible to do ?

Search these Forums for threads mentioning

en_us.notify_template.html

Yes, know were to edit it, I don’t know how. Do i need to make change in Task.php ? As i see all data coming from DataBase.

It’s basically using the generic SuiteCRM mechanism:

https://pgorod.github.io/Custom-folder/

Create any necessary subdirectories under custom
Copy the html file into it
Edit the file in custom

Ok. But i still have a question,

how to make this :

SuiteCRM Task - {TASK_SUBJECT}

{ASSIGNER} has assigned a Task to {ASSIGNED_USER}.

Subject: {TASK_SUBJECT}
Priority: {TASK_PRIORITY}
Due Date: {TASK_DUEDATE}
Status: {TASK_STATUS}
Description: {TASK_DESCRIPTION}

to work in this state:

SuiteCRM Task - {TASK_SUBJECT}, SubTask - {TM_SUBTHEME_NAME}, Account - {ACCOUNT_NAME}

{ASSIGNER} has assigned a Task to {ASSIGNED_USER}.

Subject: {TASK_SUBJECT}
SubTask: {TM_SUBTHEME_NAME}
Priority: {TASK_PRIORITY}
Due Date: {TASK_DUEDATE}
Status: {TASK_STATUS}
Description: {TASK_DESCRIPTION}

If you mean that you need to add addtional variables, then you need to “assign” them here

https://github.com/salesagility/SuiteCRM/blob/master/modules/Tasks/Task.php#L342

… but I am not sure if this customization can be made upgrade-safe, probably not. You’ll have to redo it after each upgrade that changes Task.php.

Thanks for fast answer. Can u pls show any simple code, how to make this “assign”. If it even don’t save to upgrade.

That function has all the code samples you need. Just copy one of those “assigns” for any missing variables.

I assume your variable is accessible from PHP Beans, it’s some custom field, perhaps? See this

https://docs.suitecrm.com/developer/working-with-beans/

1 Like

I what to add Account fields to template. One more question - do i need to make changes in custom/modules/Tasks/Task.php?

You should try to make the changes in custom/modules/Tasks/Task.php, to see if they get picked up from there. If not, then that file is not customizable in an upgrade-safe manner, you’ll have to edit it in core (modules/Tasks/Task.php).

You need a bit of code to navigate to the related Accounts bean so you can get the fields from there. Something like this:


$task->load_relationship('accounts');
$relatedAccountsBeans = $task->accounts->getBeans();
$accountBean = false;
if (!empty($relatedAccountsBeans)) {
        //first record in the list 
        $accountBean = current($relatedAccountsBeans);
        $xtpl->assign("ACCOUNT_EMAIL", $accountBean->email1);
}
1 Like

Thank you. It works in modules/Tasks/Task.php