ProcessData scripting - bluesoft-rnd/aperte-workflow-core GitHub Wiki

Scripting feature allows to enhance ProcessData widget elements with dynamic behaviour, e.g. hide or show them depending on user input.

Scripting engines

In order to enable scripting, there should be installed Scripting module and at least one engine plugin. At the moment, supported are languages:

Script source code

Script code could be provided via URL to external resource or entered directly (if URL is not specified). Please note that in first case, only URL is stored in process definition - source code is loaded every time script is run.

Script arguments

Script has access to argument map, containing:

  • WidgetElement objects, with its id property as a key (has to be defined). Those objects represent ProcessData form elements: containers and simple elements.
  • ProcessInstance object, which contains all of the process attributes. In argument map identified by "process" key.

Example

Widget definition below:

<widgetsDefinition>
    <form>
      <radioSelect id="select" dynamicValidation="true" defaultSelect="1">
        <item key="1" value="One-way"/>
        <item key="2" value="Round-trip"/>
      </radioSelect>
      <date bind="departureDate" readonly="false" caption="Departure date" id="dd" format="dd-MM-yyyy"/>
      <date bind="returnDate" caption="Return" id="rd" visible="false" format="dd-MM-yyyy"/>
    </form>
</widgetsDefinition>

renders simple form:

This groovy snippet shows/hides the second date field, depending on selected option:

if(select.getValue().equals("1"))
   rd.setVisible(false)
if(select.getValue().equals("2"))
   rd.setVisible(true)
⚠️ **GitHub.com Fallback** ⚠️