Substitution Variables

Hi,

Anyone know how to see list of substitution variables on ‘Email’.

I can’t find Order Delivery Date or any extra field.

Thanks in advance.

Home ->Setup->Emails->Emails templates and then click on subject ? <-sign of a question mark and you will have a list of them all

Available substitution variables:
__(AnyTranslationKey)__ ->
__DOL_MAIN_URL_ROOT__ -> 
__MYCOMPANY_NAME__ -> 
__MYCOMPANY_EMAIL__ -> 
__MYCOMPANY_PROFID1__ ->
__MYCOMPANY_PROFID2__ ->
__MYCOMPANY_PROFID3__ -> 
__MYCOMPANY_PROFID4__ -> 
__MYCOMPANY_PROFID5__ -> 
__MYCOMPANY_PROFID6__ -> 
__MYCOMPANY_CAPITAL__ -> 
__MYCOMPANY_FULLADDRESS__ ->
__MYCOMPANY_ADDRESS__ -> 
__MYCOMPANY_ZIP__ -> 
__MYCOMPANY_TOWN__ ->
__MYCOMPANY_COUNTRY__ -> 
__MYCOMPANY_COUNTRY_ID__ -> 
__ID__ -> 
__REF__ -> 
__REFCLIENT__ -> 
__REFSUPPLIER__ -> 
__EXTRAFIELD_XXX__ -> 
__THIRDPARTY_ID__ -> 
__THIRDPARTY_NAME__ -> 
__PROJECT_ID__ ->
__PROJECT_REF__ -> 
__PROJECT_NAME__ -> 
__CONTRACT_HIGHEST_PLANNED_START_DATE__ -> 
__CONTRACT_HIGHEST_PLANNED_START_DATETIME__ -> 
__CONTRACT_LOWEST_EXPIRATION_DATE__ -> 
__CONTRACT_LOWEST_EXPIRATION_DATETIME__ -> 
__ONLINE_PAYMENT_URL__ -> 
__SECUREKEYPAYMENT__ -> 
__SECUREKEYPAYMENT_MEMBER__ -> 
__SECUREKEYPAYMENT_ORDER__ -> 
__SECUREKEYPAYMENT_INVOICE__ -> 
__SECUREKEYPAYMENT_CONTRACTLINE__ -> 
__DATE_YMD__ -> 
__DATE_DUE_YMD__ -> 
__AMOUNT__ -> 
__AMOUNT_EXCL_TAX__ ->
__AMOUNT_VAT__ -> 
__DAY__ -> 
__MONTH__ -> 
__YEAR__ -> 
__PREVIOUS_DAY__ -> 
__PREVIOUS_MONTH__ -> 
__PREVIOUS_YEAR__ -> 
__NEXT_DAY__ -> 
__NEXT_MONTH__ -> 
__NEXT_YEAR__ -> 
__USER_ID__ -> 
__USER_LOGIN__ ->
__USER_LASTNAME__ ->
__USER_FIRSTNAME__ ->
__USER_FULLNAME__ -> 
__USER_SUPERVISOR_ID__ -> 
__USER_SIGNATURE__ -> 
1 Like

What about Order planned date of delivery?

I don’t think it exists

1 Like

I have found the way to add new substitution variables. Hope the below method helps others as well.

The file to edit: html.formmail.class.php

An example of adding address to the emails: (near line 1017)
$this->substit[‘THIRDPARTY_ADDRESS’] = (is_object($object->thirdparty)?$object->thirdparty->getFullAddress():’’);

For date of delivery (near line 1017):
$this->substit[‘DATE_ORDER’] = dol_print_date($object->date_livraison, ‘day’, 0, $outputlangs);

2 Likes

Great! Well done! Did you have time to test it fully? Can you confirm it works well?

Another handy tip for email is passing variables in URLS back to your servers or projects.

Open’ Project card
https://hostname/dolibarr/htdocs/projet/card.php?id=PROJECT_ID

Search file server for all files relating too.
https://spserver/search/Pages/results.aspx?k=REF

Yes it is working, tested it

Dear all,

in version 7.0.1 the file where definition of substitution variables for email are defined has been changed from html.formmail.class.php as mentioned above to file functions.lib.php
Substitution variables can be defined near line 5490.
The description of the substitution variable listed in the context menu can be defined near line 5450.

Enjoy it, J.

1 Like

Hi !
See my post in french forum : https://www.dolibarr.fr/forum/12-howto--aide/60336-variables-email-facture-ne-fonctionnent-plus-en-6?start=15#95534
@+

2 Likes

why are some of the Substitution Variables not working?
For example
PROJECT_ID -> PROJECT_ID
PROJECT_REF -> PROJECT_REF
PROJECT_NAME -> PROJECT_NAME
are not working- the Variables are not beeing replaced with the right value

Hi,

Most probably because from where you are sending the mail, the object doesn’t contain a project.