Allmost all tasks have configuration fields, which could be filled with variables.

All textfields which look like the image right, are capable of this feature.
If the textfield/textarea looks like the second image on the right with a green icon it is a pure custom expression field, which needs a valid expression and return statement with value.
Plain Text here will lead into errors. If you don't know what you should insert, don't use this fields!

This custom expressions are php scripts, which allow the most complex generation of values.

I will mention which template feature could be used inside which textfield (blue, green). If you want to only select values from fields, without complex calculations, please ignore the information about the green textbox and don’t select “function” if there is this option before a textfield.

1. Default variables

$fieldname

This is the most common way to use templates and is available in both field types. This variables will be replaced by the fieldvalue of the record, which runs the workflow. For example there is $accountname, $lastname, $firstname, $bill_street, … . The complete list of possible variables, you get by click on the blue/green box icon. This variables could be used inside the default blue Template fields and the “green” textareas. This is a readonly Access, which couldn’t be used to change the content of a field.

Inside the green custom functions there is a special feature, because you could generate temporary variables, which are available only in this script. The name of this variables have to follow the php structure of variables. This variables will be removed at the end of the custom expression.

2. Relation fields

blue Textfields: $(contact_id: (Contacts) leadsource) \\
green Textfields: $account_id->Accounts->tickersymbol

This could be used to access the value of a field inside a referenced record. (For example a value from Organization from Contacts module) All possible variables (also this relations) are accessible over the blue/green icon. You don’t need to create the following structure by yourself!

In the blue Textbox this variable use this structure: $(contact_id: (Contacts) leadsource) The green textbox use another structure, because of the php base: $account_id→Accounts→tickersymbol

3. Quick Helpers

The blue Textfields have some special functions, which allows to make some simple calculations.

Currently the only helper are:

$[Now] – insert the current date in format (YYYY-MM-DD)
$[Now,-x] – insert the current date -X days in format (YYYY-MM-DD)
$[Now,+x] – insert the current date +X days in format (YYYY-MM-DD)
$[Now,0,'d.m.Y'] – insert the current date in format (DD.MM.YYYYY) You get possible placeholders here.
$[Now,0,'H:i:s'] – insert the current time in format (HH:MM:SS)You get possible placeholders here.
$[entityname,$id] – Replace the ID with the Name of the Record (Accountname, Firstname & Lastname, …)
$[dateformat,$date,“d.m.Y”] – insert the given datetime in format (DD.MM.YYYYY) You get possible placeholders here.
$[utctz,$time] - If you create events and want to use a time field as source for the start time you probably need this function to clear the timezone from the time field.
$[link,$crmid] - Insert a HTML Link with Record Label
$[round,$number,$decimals] - Round a number to $decimals places

At the moment this feature don’t allow calculations with a date within a field! Only with the current date.

Please read the following sections only, if you have some basic development skills, because they make use of the custom functions. (Green textfield)

4. Insert of custom functions inside default template fields

A big improvement was the feature to insert a custom expression in every default textfield. (blue icon) This makes it possible to generate very complex values by the the usage of lots of php functions, without the limitations to the functions (green) textfields.

You only need to insert the following:

${ ... custom function ... return "result"; }}>

Instead of ${ … }}> you also could use <?php … ?>, because the used script language is similar to PHP. But these default PHP tags do not work within the HTML Editor, which the module use to create an E-Mail.

The return statement is imperative, because the complete block (from “${” to “}}>” ) will be replaced the the return value. This allows for example the insert of a rounded total sum of an invoice by:

${ return round($hdnGrandTotal, 2); }}>

Also this feature allows the calculation of dates from fields by:

${ $date = strtotime($fieldname); $new_date = strtotime($date, "+1 day"); return date("Y-m-D", $new_date); }}>

Please note, you have to use the related variable structure of custom functions ($field→module→field) and not the Template structure of variables. ($field (module) field) The Variable chooser do not know this and you need to change the format for yourself.

Other examples I will mention on a separate custom function page.

5. use environment variables (Only Green Textfields and custom functions)

This environment variables could be used to transfer a value from one task to another task, because they won’t be clear after the task is ready.

You could access this variable normally with the $env – Array. To set a $env Variable you have to use: $env[“variableame”] = “content of the env. variable”; If you want to get this value in another/or the same task, you only should use

… $env[“variablename”] …

Enter your comment. Wiki syntax is allowed:
  ____    __      __   __   _____
 / __ \  / /  __ / /  / /  / ___/
/ /_/ / / /__/ // /  / /__/ (_ / 
\___\_\/____/\___/  /____/\___/