public class RulePlugin extends AbstractPlugin
// test first value of the workitem attribute 'txtname'
var isValid = ('Anna'==workitem.txtname[0]);
A script can add new values for the current workitem by providing the JSON
object 'result'.
var result={ someitem:'Hello World', somenumber:1};
Also change values of the event object can be made by the script. These
changes will be reflected back for further processing.
// disable mail
event.keymailenabled='0';
A script can set the variables 'isValid' and 'followUp' to validate a
workItem or set a new followUp activity.
result={ isValid:false };
If the script set the variable 'isValid' to false then the plugin throws a
PluginExcpetion. The Plugin evaluates the variables 'errorCode' and
errorMessage. If these variables are set by the Script then the
PluginException will be updates with the corresponding errorCode and the
'errorMessage' as params[]. If no errorCode is set then the errorCode of the
PluginException will default to 'VALIDATION_ERROR'.
If the script set the variable 'followUp' the follow-up behavior of the
current ActivityEntity will be updated.
If a script can not be evaluated by the scriptEngin a PluginExcpetion with
the errorCode 'INVALID_SCRIPT' will be thrown.
NOTE: all variable names are case sensitive! All JSON object elements are
lower case!| Modifier and Type | Field and Description |
|---|---|
static String |
INVALID_SCRIPT |
static String |
VALIDATION_ERROR |
INVALID_ITEMVALUE_FORMAT, INVALID_PROPERTYVALUE_FORMAT| Constructor and Description |
|---|
RulePlugin() |
| Modifier and Type | Method and Description |
|---|---|
ItemCollection |
run(ItemCollection adocumentContext,
ItemCollection adocumentActivity)
The run method evaluates a script provided by an activityEntity with the
specified scriptEngine.
|
close, getCtx, getWorkflowService, init, mergeFieldList, uniqueListpublic static final String INVALID_SCRIPT
public static final String VALIDATION_ERROR
public ItemCollection run(ItemCollection adocumentContext, ItemCollection adocumentActivity) throws PluginException
PluginExceptionCopyright © 2006–2019 Imixs Software Solutions GmbH. All rights reserved.