Conditional Triggers

Root > 3. Customisation



    Follow WiredContact on Twitter

Conditional triggers are set via the conditional trigger sections defined in the subentity dialog templates. Examples of subentity dialog templates are Schedule.html, NewSale.html and EditHistory.html.

Some subentity dialogs have default conditional trigger behaviors that can be overridden.

You can record a history item if a specific condition is met. For example, you may want to add a history item when you close a sale. Conditional History Item triggers are defined in the <#recordhistoryitemx>/<#/recordhistoryitemx> sections - where x is an integer value (1, 2 or 3 for example). You setup the parameters for the Conditional History Item trigger in this section. Parameters are:

  • TestBefore - Conditional statement prior to update - must evaluate to true for even to happen
  • TestAfter - Conditional statement after update - must evaluate to true for even to happen
  • _HType - Value of history type
  • _Subject - Value of history regarding/subject
  • _Notes - Value of history details/notes
For example, to add a history record when a Sales item is changed from Open (or blank) to Won:
Note - this is the default behavior
testbefore=<#field field=salestatus blank="" notblank="open">=<#field field=salestatus>
testafter=Open<><#field field=salestatus>
_HType=<#field field=salestatus test1='Won' val1='Completed/Won' test2='Lost' val2='Lost Sale'>
_subject=Completed Sale for <#parent field=EntityNameField>, <#parent field=EntityName2Field>
_Notes=Sales Stage <#field field=stage><br>Product Name: <#field field=productname><br>Product Type: <#field field=producttype><br>...Details: <#field field=notes>

In the above example, standard WCE tags were used to generate appropriate values for the pre/post conditional statements, as well as the contents of the fields in the new history record.

The default section for the wce_sales table is <#RecordHistory> - to override the default, you must at least define the TestBefore and TestAfter parameters of this section.

Add Feedback