Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
en:extensions:workflowdesigner:template-features [2014/01/01 17:00]
swarnat
en:extensions:workflowdesigner:template-features [2017/05/05 13:49]
swarnat
Line 1: Line 1:
 ====== Template features ====== ====== Template features ======
 +{{ :​en:​extensions:​workflowdesigner:​textfield.png?​nolink|}}
 +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. ​
  
-Allmost all tasks have configuration fields, which could be filled with variablesYou could recognize this feature if there is an icon next to the textfield, which shows this blue box:+{{ :​en:​extensions:​workflowdesigner:​expressionfield.png?​nolink|}} 
 +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!
  
-If there is a green box, next to a textarea, this isn’t a default text field, but an custom function field. ​This custom ​function ​are php scripts, which allow the most complex generation of values. But this feature needs some development skills, because there must be a “return” statement, which returns the result.+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 green textbox and don’t select “function” if there is this option before a textfield.+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 ​=====
-===== 1. Default ​fields ​=====+
  
   $fieldname   $fieldname
   ​   ​
-**This is the most common way to use templates.** This variables will be replaced by the content ​of the field you reference by “fieldname”. 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+**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 script.+
  
 +<WRAP info>
 +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.
 +</​WRAP>​
 ===== 2. Relation fields ===== ===== 2. Relation fields =====
  
-  $(contact_id:​ (Contacts) leadsource) +  ​blue Textfields: ​$(contact_id:​ (Contacts) leadsource) 
-  $account_id->​Accounts->​tickersymbol+  ​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! 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!
Line 33: Line 38:
 **$[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,​+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,+x days/​weeks/​months]** – insert the current date with modifications from interval (YYYY-MM-DD) (Available interval settings: [[http://​php.net/​manual/​de/​datetime.formats.relative.php]]) 
 +**$[Now,​0,'​d.m.Y'​]** – insert the current date in format (DD.MM.YYYYY)[[http://​php.net/​manual/​de/​function.date.php|You get possible placeholders here.]] 
 +**$[Now,​0,'​H:​i:​s'​]** – insert the current time in format (HH:​MM:​SS)[[http://​php.net/​manual/​de/​function.date.php|You get possible placeholders here.]] 
 +**$[Now,"​+5 days",,​$now]** - //(From version 600.1701)// - Date calculations are relative to the date within $now variable. Could be static string or fieldvariable. Third format parameter could also be set!
 **$[entityname,​ $id]** – Replace the ID with the Name of the Record (Accountname,​ Firstname & Lastname, ...) **$[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) [[http://​php.net/​manual/​de/​function.date.php|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.** **At the moment this feature don’t allow calculations with a date within a field! Only with the current date.**
  
 <WRAP info>​Please read the following sections only, if you have some basic development skills, because they make use of the custom functions. (Green textfield)</​WRAP>​ <WRAP info>​Please read the following sections only, if you have some basic development skills, because they make use of the custom functions. (Green textfield)</​WRAP>​
- 
 ===== 4. Insert of custom functions inside default template fields ===== ===== 4. Insert of custom functions inside default template fields =====
  
-A big improvement was the feature to insert a custom ​function ​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. ​//If the available visible space isn’t enough, please double click on a textfield. A popUp with a bigger textfield will be displayed.//​+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: You only need to insert the following:
  
   ${ ... custom function ... return "​content";​ }}>   ${ ... custom function ... return "​content";​ }}>
-  ​+ 
 +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: 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:
  
Line 56: Line 69:
   ${ $date = strtotime($fieldname);​ $new_date = strtotime($date,​ "+1 day"); return date("​Y-m-D",​ $new_date); }}>  ​   ${ $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 the blue Icon still supplies the default ​structure. ($field (module) field)//+//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. Other examples I will mention on a separate custom function page.