Skip to main content

Workflow settings

WorkflowTrigger

General

The WorkflowTrigger allows you to define Pre- and After-Actions. The definition of this trigger occurs at the Workflow-XML and must be indicated as a subitem in the respective WorkflowNode. The trigger is implemented at Param-Level, which is a child element of the WorkflowTrigger. If you like to perform several DML-Statements, they must be separated by a semicolon at the parameter.

Overview of the trigger types

  • SQL Trigger
  • SQL Iterator Trigger
  • SQL File Iterator Trigger
  • Mail Trigger
  • Session/Remove Session Trigger
  • Log Trigger
  • Custom Trigger

Attributes

Attribute Mandatory Description Example
name yes Unique name of the trigger (has to be written in UPPERCASE letters and must not contain any special characters). name="UPDATE_INCIDENT_TRIGGER"
authorization no Only users with the appropriate Role/Claim are authorized to view/process the element.
  • authorization="ROLE[ADMIN,EDITOR]"
  • authorization="CLAIM[WF_ADMIN,WF_EDIT]"
condition no Condition to be evaluated for the Workflow-Trigger, which defines if the trigger will be fired or not. The condition types are the same as for the Workflow-Node element. Details can be found here.
  • condition="SQL[...sql-statement...]"
  • condition="{FORM.MARKER}"
The {FORM.MARKER} works if the field MARKER is a checkbox FormField delievering 0 or 1.
label no The label of the trigger. label="Update-Trigger XYZ"
method no Defines when the trigger will be executed (before, after, action). This depends on the enclosing Workflow-Node. More information can be found here. method="after"
type no The trigger type SqlTrigger is used for the manipulation of database objects. The SessionTrigger is used to manipulate session values.
  • SqlTrigger
  • MailTrigger
  • SessionTrigger
  • SqlIteratorTrigger
  • RemoveSessionTrigger
  • SqlFileIteratorTrigger
type="SqlTrigger"

Example:

  
<WorkflowTrigger name="UPDATEINCIDENTTRIGGER" type="SqlTrigger"  method="after"
  condition="SQL[SELECT DECODE(({FORM.STATUS_ID}),3,DECODE(((SELECT
      COUNT(*) FROM ACTIVETASK WHERE INCIDENT_ID={FORM.INCIDENT_ID} AND STATUS_ID!=3 AND
      ID!={FORM.ID})),0,1,0),0) From Dual]">
 <Param name="Sql" value="UPDATE INCIDENT1 SET STATUS_ID = 3 WHERE RPI_ID ={FORM.INCIDENT_ID}"/>
</WorkflowTrigger>
  

Methods

Defines when the trigger will be executed (before, after, action). This depends on the enclosing Workflow-Node.

The following methods are available:

Method Supported Controllers
before Form/Index
Form/ModalIndex
List/Index
List/Page
after Form/Save
Form/Delete
List/Select
Workflow/Index
afterinsert Form/Save
beforeinsert Form/Save
beforeupdate Form/Save
afterupdate Form/Save
beforedelete Form/Delete
afterdelete Form/Delete
action This method is supported for user-defined buttons.

Parameters

You can pass parameters to triggers. A parameter can carry any kind of information and some of them are required for the correct execution of the trigger. For example, the SqlTrigger requires a parameter named Sql containing the SQL statement which will be executed

Attributes

Attribute Mandatory Description Example
name yes The name identifies the property of the trigger. name="Sql"
value yes The value contains the DML-Statement (for example: INSERT, DELETE, UPDATE) for the trigger. name="UPDATE INCIDENT1 SET STATUS_ID = 3 WHERE RPI_ID = {FORM.INCIDENT_ID}"

Example:

  
<Param name="Sql" value="UPDATE INCIDENT1 SET STATUS_ID = 3 WHERE RPI_ID ={FORM.INCIDENT_ID}"/>
  

Standard Triggers

SqlTrigger

With this trigger you are able to execute a SQL statement based on the defined SQL Statement in the parameters.

Parameters:

Name Mandatory Description Value
Sql yes Defines the SQL statement to execute SQL statement with placeholders

Example 1 - method="after":

This trigger fires after the node has been processed, for example, after a save - action. First the trigger checks if a certain condition is valid and then it executes the defined SQL-Statement.

  
<WorkflowTrigger name="SqlTriggerAudit" method="after" type="SqlTrigger" condition="OBJECT[HasValueProvider.GetValue({FORM.ID})]">
  <Param name="Sql" value="Insert Into BUILDINGEXTENSIONAUDIT(EDITOR,BUILDINGEXTENSION_ID)
      Values({USER.NAME}, {FORM.ID})" />
</WorkflowTrigger>
  

Example 2 - method="action":

This trigger fires after a button - action. First the trigger checks if a certain condition is valid and then it executes the trigger.

  
Configuration in the FormSettings.xml:
...
    action="SCRIPT[IG.trigger(...)]"
...

Configuration in the WorkflowSettings.xml:
 ...
 <WorkflowTrigger name="DeleteFileTrigger" type="SqlTrigger" method="action">
   <Param name="Sql" value="Delete From BE_ATTACHMENT1 Where ID = {REQUESTCONTEXT.fileId}"/>
 </WorkflowTrigger>
 ...
  

SqlIteratorTrigger

With this trigger you are able to execute SQL for each array placeholder referenced in the SQL statement.

Parameters:

Name Mandatory Description Value
Sql yes Defines the SQL statement to execute SQL statement with placeholders

Example:

This trigger iterates over a preselected list of values from a type="listbox" with multiselect="true". The first Param-Tag is used for the definition of the array. For example, the second Param-Tag could be used to execute an SQL-Statement for each loop iteration; the iterator is referenced via {ITERATOR}.

  
Configuration in the FormSettings.xml:
...
<FormTable name="CHECKCELL_GRID" label="Liste der Zellen:" multiselect="true" type="listbox"
			rowcount="5" datatype="string" lov="SQL[SELECT ...]" persisted="false" required="false"  />
...

Configuration in the WorkflowSettings.xml:
...
<WorkflowTrigger name="SampleSqlIterator" type="SqlIteratorTrigger" method="action">
  <Param name="Sql" value="Delete From BE_ATTACHMENT1 Where ID = {FORM.UploadedFiles}"/>
</WorkflowTrigger>
...
  

MailTrigger

With this trigger you are able to send an email.

Parameters:

Name Mandatory Description Value
From yes Defines the email adress of the sender.
  • Placeholder
  • Static value
  • SQL statement
  • Object
Recipients yes Defines the list of recipients.
  • Placeholder
  • Static value
Subject yes The subject of the email.
  • Placeholder
  • Static value
  • SQL statement
Body yes The content of the email.
  • Placeholder
  • Static value
  • SQL statement
IsBodyHtml no Indicator if the content should be sent in HTML.
  • Placeholder
  • Static value
  • SQL statement
Attachments no Files to attach to the email.
  • Placeholder

Example:

  
<WorkflowTrigger name="MailTrigger" type="MailTrigger" method="action">
	<Param name="From" value="{FORM.From}" />
	<Param name="Recipients" value="{FORM.Recipients}" />
	<Param name="Subject" value="{FORM.Subject}" />
	<Param name="Body" value="{FORM.Body}" />
</WorkflowTrigger>
  

Note: To enable the mail trigger you need to change the configuration of the web.config as following:

  
<system.net>
    <mailSettings>
      <smtp from="noreply@company.com">
        <network host="mailserver.company.com" port="25"/>
      </smtp>
   </mailSettings>
</system.net>
  

SessionTrigger

With this trigger you can store key/value pairs into the active session.

Parameters:

Name Mandatory Description Value
Key yes The name of the key to store in the session.
  • Placeholder
  • Static value
  • SQL statement
  • Object
Value yes The value to store in the session.
  • Placeholder
  • Static value
  • SQL statement
  • Object

Example 1 - method="before":

  
<WorkflowTrigger name="SampleSessionTrigger" type="SessionTrigger" method="before">
	<Param name="Key" value="ExtensionTypeName"/>
	<Param name="Value" value="SQL[Select e.Name From EXTENSIONTYPE e INNER JOIN BUILDINGEXTENSION
      b on b.EXTENSIONTYPE_ID = e.ID Where b.ID = {SESSION.BUILDINGEXTENSION.ID}]"/>
</WorkflowTrigger>
  

Example 2 - method="action":

  
<WorkflowTrigger name="ParcelSessionTrigger" type="SessionTrigger" method="action">
 <Param name="Key" value="PARCEL_ID"/>
 <Param name="Value" value="{FORM.ParcelsTable}"/>
</WorkflowTrigger>

<WorkflowTrigger name="ParcelRCSessionTrigger" type="SessionTrigger" method="action">
  <Param name="Key" value="PARCEL_ID"/>
  <Param name="Value" value="{REQUESTCONTEXT.PARCEL_ID}"/>
</WorkflowTrigger>
  

RemoveSessionTrigger

With this trigger you can delete key/value pairs from the active session.

Parameters:

Name Mandatory Description Value
Key yes The name of the key to delete from the session.
  • Placeholder
  • Static value
  • SQL statement
  • Object
Value yes The value to store in the session.
  • Placeholder
  • Static value
  • SQL statement
  • Object

Example:

  
<WorkflowTrigger name="SampleRemoveSessionTrigger" type="RemoveSessionTrigger" method="after">
	<Param name="Key" value="ExtensionTypeName"/>
</WorkflowTrigger>
  

LogTrigger

With this trigger you are able to log a message.

Parameters:

Name Mandatory Description Value
Message yes The message to write to the log file.
  • Placeholder
  • Static value
  • SQL statement
  • Object

Example:

  
<WorkflowTrigger name="SampleLogTrigger" method="after" type="LogTrigger">
	<Param name="Message" value="I have logged the id: {FORM.ID}"/>
</WorkflowTrigger>
  

Custom Triggers