M416 AUTOMATED STEP
Last updated Nov 09, 2017

Create your own Auto-Step for Business Process Definition

If you want to automate a Processing-step, such as "Obtaining Number of characters and Hash value", you need to write Scripts using [Script Task]. If you need to use the same [Script Task] in different places, you should consider packaging the Script as a [Addon XML]. (Service-Task Addon)

M416-1-en


a. Aspect of IT Skill Requirments (Compared with Script Task)
A Flow Designer who does not have Script knowledge should be capable of promoting the automation of the process, as well
b. Aspect of Modeling Cost (Compared with Script Task)
There will be no need to write the same Script again and again
  • It can be considered a responsibility in the boundary between the IT Department and the Process owner
  • Go to M415 for more info on how to import a preexisting [Addon XML]
  • Go to M416 (Bottom of this page) or to “Download” in M415 for Sample codes

a. Aspect of Output of the Auto-step
e.g.: Contents of Data to be stored, Contents of Auto-operation of external system, etc.
b. Aspect of Input of the Auto-step
e.g.: Business data to be inspected, Data name in external system to retrieve, etc.
  • Name of Auto-step (Service Task) is defined in <label> element (64 characters max.)
  • Sample of a: <label>Random Number Generator</label>
  • Sample of b: <label>Weather Info Getter</label>
  • You can define an overview in <summary> element (250 characters max.)
  • You can define URL of help page in <help-page-url> element (250 characters max.)

a. Business Data Items which are to be referred by the Step (SELECT)
e.g.: To write to Data A, To read Data B. etc.
b. Fixed Values used in the Step (TEXTFIELD, TEXTAREA)
e.g.: Maximum value: “100”, Status:This Draft is on the stage of not yet approved, etc.
  • Enumerate Configuration Items with <config> which is a child element of <configs>
  • You can enumerate up to 20 configuration items <config>

R4160 Addon-XML Attributes of config element

1. Write a Server-side Script
Write in ECMA code available in Script Step (M230)
  • Knowledge of ECMAScript (JavaScript) is required
  • Parts of Java class are also available
  • Use special methods of configs.get("♦configName♦") for retrieving config
  • configs.get("♦configName♦"): instanceof java.lang.String
  • Use special methods of data.get( ♦dataId♦ ) for retrieving Business Data (M230)
  • Use special methods of retVal.put( ♦dataId♦, ♦value♦ ) for updating Business Data (M230)
<script><![CDATA[
var dataItemId = configs.get("conf_updateDataItem"); 
retVal.put( dataItemId, "Hello World" );
]]></script>

R2300 Functions available in Script

1. Prepare an Image File
Prepare a Image file of less than 64px (JPEG, GIF, PNG only)
2. Encode to Base64
Use Converter software or web service for it
  • Define using the icon data<icon> element
  • The Logo will be displayed upon placement using Drag&Drop

1. Add label elements with the locale attribute
Add <label> for as many languages as you need for your Workflow Designers
  • e.g.: Configure <label locale="ja">Generador de Numeros aleatorios</label> for Spanish Designers
  • en(default), ja, de, es, fr, ko, pt, zh_CN

M416-2-en

M416-3-en



Sample A1

<?xml version="1.0" encoding="UTF-8"?><service-task-definition>

<label>Random Number Generator</label>

<summary>A random number that does not exceed the config "A" (e.g.: 0 to 99) will be stored in the Data item selected in the config "B"
</summary>


<help-page-url>https://www.questetra.com/tour/m4/m415/addon-random-number/</help-page-url>

 

<configs>
<config name="conf_MaxNum" required="true" form-type="TEXTFIELD">
<label>A: Set Max Number (100 returns 0 - 99)</label>
</config>
<config name="conf_DataIdB" required="true" form-type="SELECT" select-data-type="DECIMAL">
<label>B: Select NUMERIC DATA for Random Number (update)</label>
</config>
</configs>

 

<script><![CDATA[
// Random Number Generator (ver. 20181018)
// (c) 2017, Questetra, Inc. (the MIT License)

//// == Config Retrieving ==
var maxNum = configs.get( "conf_MaxNum" ) - 0;
// convet 'java.lang.String' to 'javascript number'
var dataIdB = configs.get( "conf_DataIdB" ) + "";
// convet 'java.lang.String' to 'javascript string'

//// == Data Retrieving ==
// (none)

//// == Calculating ==
var randNum = Math.floor( Math.random() * maxNum );
// Math.random(): 0.00 to 0.99

//// == Data Updating ==
engine.setDataByNumber( dataIdB, java.math.BigDecimal( randNum ) );
]]></script>

 

<icon>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAEFUlEQVRYR8VXQVIbORT9X2bVXgRO
EDjBhBPE2YFEVcgJEk4w5ASBE4w5QewT4FQhwS7mBIETBE4wnkU3G7p/6mkkl1rT7ZhJqugqqgC1
paf333v/m+mZH37m8+mXAezt7W0z80tc5OHh4XY+ny+ecqn/DUBr/YmIPjDzdnqgiNwR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0zx2j/NwfC
mD0PU2xfeVvqzhjp+sySpZ4Nb8uyHEGs3oYBBMTSmmrCh6fMPMkHSwRSGFRicwHIe4zleBcJmIzn
fqvgAHxpGUentIIING5sbPj2+/j4ePezLxURvFJqs2maRdf4jcthHe92TcdrDaW9dfkNC88O4AcI
zqgZxW8imAAAAABJRU5ErkJggg==
</icon>

</service-task-definition>
Sample A2

<?xml version="1.0" encoding="UTF-8"?><service-task-definition>

<label>Random Number Generator (dynamic)</label>

<summary>A random number that does not exceed the number in the Data item selected config "A" (e.g.: 0 to 99) will be stored in the Data item selected in the config "B"
</summary>


<help-page-url>https://www.questetra.com/tour/m4/m415/addon-random-number-2/</help-page-url>

 

<configs>
<config name="conf_DataIdA" required="true" form-type="SELECT" select-data-type="DECIMAL">
<label>A: Select NUMERIC DATA for Max Number (100 returns 0 - 99)</label>
</config>
<config name="conf_DataIdB" required="true" form-type="SELECT" select-data-type="DECIMAL">
<label>B: Select NUMERIC DATA for Random Number (update)</label>
</config>
</configs>

 

<script><![CDATA[
// Random Number Generator - Dynamic (ver. 20181020)
// (c) 2017, Questetra, Inc. (the MIT License)

//// == Config Retrieving ==
var dataIdA = configs.get( "conf_DataIdA" ) + "";
var dataIdB = configs.get( "conf_DataIdB" ) + "";
// convet 'java.lang.String' to 'javascript string'

//// == Data Retrieving ==
var maxNum = engine.findDataByNumber( dataIdA ) - 0;
// convet 'java.math.BigDecimal' to 'javascript number'

//// == Calculating ==
var randNum = Math.floor( Math.random() * maxNum );
// Math.random(): 0.00 to 0.99

//// == Data Updating ==
engine.setDataByNumber( dataIdB, java.math.BigDecimal( randNum ) );
]]></script>

 

<icon>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAEFUlEQVRYR8VXQVIbORT9X2bVXgRO
EDjBhBPE2YFEVcgJEk4w5ASBE4w5QewT4FQhwS7mBIETBE4wnkU3G7p/6mkkl1rT7ZhJqugqqgC1
paf333v/m+mZH37m8+mXAezt7W0z80tc5OHh4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