M416 AUTOMATED STEP
Last updated Sep 15, 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
  • Sample of a: <label>Random Number Generator</label>
  • Sample of b: <label>Weather Info Getter</label>

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>

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



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

<label>Random Number Generator</label>
<label locale="es">Generador de Numeros aleatorios</label>


<configs>
 <config name="conf_MaxNum" required="true" form-type="TEXTFIELD">
 <label>Set MAX NUMBER (100 returns 0 - 99)</label>
 <label locale="es">Establece el numero maximo (100: 0 - 99)</label>
 </config>
<config name="conf_UpdateDataId" required="true" form-type="SELECT" select-data-type="DECIMAL">
 <label>Select RANDOM NUMBER DATA</label>
 <label locale="es">Seleccione unos datos de numericos que se almacena un numero aleatorio</label>
 </config>
</configs>


<script><![CDATA[
var maxNum = configs.get( "conf_MaxNum" ); 
var dataId = configs.get( "conf_UpdateDataId" ); // (returns Number)
var tmpNum = Math.random() * maxNum; // Math.random() -> 0.00 ~ 0.99
var retNum = Math.floor( tmpNum );
retVal.put( dataId, java.math.BigDecimal( retNum ) );
]]></script>


<icon>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAEFUlEQVRYR8VXQVIbORT9X2bVXgROEDjBhBPE2YFEVcgJEk4w5ASBE4w5QewT4FQhwS7mBIETBE4wnkU3G7p/6mkkl1rT7ZhJqugqqgC1paf333v/m+mZH37m8+mXAezt7W0z80tc5OHh4XY+ny+ecqn/DUBr/YmIPjDzdnqgiNwR0biqquk6YJ4MQGv9iojO84PzW4vITdM0766urgCo93kSANA9GAy+EdEmdhSRM6XU7OLiYo6/sa6U+kBEx8z8gojm1to3vw2A1vobM78SkX+IaOScuxmNRh5MSvfBwcFIRL4GkLt4rw/E2gxorVHvz+mmOLwoCoDarOt6N6XbGCN4l5nfRIa6QDwFwPdQ96m1FjRTBmrmnHuH/6cM1HW9s0oHawGA8JgZtad0w1iSeDMIj5l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