Studio Developer Manual / Version 2101
Table Of Contents
Custom Workflows may require additional workflow parameters. This section
describes how to configure these parameters and how you can display them
in CoreMedia Studio by using the
AddTranslationWorkflowPlugin
or AddPublicationWorkflowPlugin
in your own CoreMedia Blueprint extension.
Adding Workflow Fields to the Workflow Windows
Additional parameters can be added to the workflow window by adding fields to the start, inbox, pending or
finished form. You can set your fields anywhere in the WorkflowForm, or use the predefined AdditionalWorkflowFieldsCollapsible
.
Therefore, each default implementation of the WorkflowForm provides an Array, called additionalFields
where you simply place your custom workflowFields.
<collab:AddTranslationWorkflowPlugin processDefinitionName="Custom_Translation"> <collab:pendingForm> <collab:DefaultTranslationWorkflowInfoForm showTranslationStatus="true"> <collab:additionalFields> <collab:WorkflowTextField key="customVariable" fieldLabel="My Costom variable"/> </collab:additionalFields> </collab:DefaultTranslationWorkflowInfoForm> </collab:pendingForm> </collab:AddTranslationWorkflowPlugin>
A workflow field can display or write any process variables. Therefore, it is also possible to include the values
of your custom fields within the workflow validation.
You can add any component to the container, that implements the Mixin IAdditionalWorkflowDisplayFieldMixin
to display
values or IAdditionalWorkflowInputFieldMixin
to write values.
Also, you can use already existing components like the WorkflowTextField
, WorkflowDateField
,
WorkflowDateTimeField
, WorkflowTextDisplayField
or WorkflowDateDisplayField
to add or display string or date parameters of your custom workflow.
Each additional field needs a unique key
.
The key needs to match a variable in your workflow definition that you want to display or write.
You should also set a fieldLabel
to.
In case that you want to use the properties provided by any of the AdditionalFields-Mixin (for example,
remoteValidationTrigger
), you can only do that
after the afterWorkflowFieldInitialized
has been called. This method will be called when all properties have
been set. Implement this method, if you want to add any event listeners to your WorkflowField. Do not place them in
the constructor, as this might lead to unexpected behaviour!
Displaying custom workflow variables
If you want to display variables of your process, you need to provide a field that implements the Mixin IAdditionalWorkflowDisplayFieldMixin
.
The setValue
method will then be called by the workflow framework with the value of the process to set.
You can either write that value directly to your Field or modify it.
A field that is added to an inbox
form will receive a ValueExpression taskVE
that resolves
to the current task of the process.
Writing custom workflow variables
If you want to write variables to your process, you need to provide a field that implements the mixin IAdditionalWorkflowDisplayFieldMixin
.
Values of your IAdditionalWorkflowInputFieldMixin
implementation will be written to the process automatically when you
press the Start
Button of your StartWorkflowWindow. If you want to write variables to a process in a running workflow,
you need to call the passed method writeValueToProcessTrigger
. This is a function that you can simply call without
any parameters. It will trigger a writeAction
that writes the value of your field to the process.
The workflow framework will then write the value, returned by the getValue
method of your Field.
If you want to include your custom field into your workflow validation, please refer to Section 7.22.1.3.2, “Studio Client”.
An IAdditionalWorkflowInputFieldMixin
will also receive a so called readOnlyValueExpression
, which will result to
true
when the workflow form should be readonly
. You can use this expression to also make your Field readonly, in case it
should behave like the rest of the WorkflowForm.
The following example shows the WorkflowTextField
which can display or write string variables of a process
and will be readOnly
when the readOnlyValueExpression
resolves to true.
public class WorkflowTextField extends StatefulTextField implements IAdditionalWorkflowInputFieldMixin { public function WorkflowTextField(config:WorkflowTextField = null) { config.labelSeparator = config.labelSeparator || ""; config.labelAlign = config.labelAlign || "top"; config.allowBlank = config.allowBlank || false; super(config); } public function afterWorkflowFieldInitialized():void { if (!readOnlyValueExpression) { return; } this.setReadOnly(readOnlyValueExpression.getValue()); var that:* = this; readOnlyValueExpression.addChangeListener(function (ve:ValueExpression):void { that.setReadOnly(ve.getValue()); }); } /** @inheritDoc */ public native function set readOnlyValueExpression(readOnlyValueExpression:ValueExpression):void; /** @inheritDoc */ public native function set key(key:String):void; /** @inheritDoc */ public native function get key():String; /** @inheritDoc */ public native function set taskVE(taskVE:ValueExpression):void; /** @inheritDoc */ public native function get taskVE():ValueExpression; /** @inheritDoc */ public native function set remoteValidationTrigger(remoteValidationTrigger:Function):void; /** @inheritDoc */ public native function get remoteValidationTrigger():Function; /** @inheritDoc */ public native function set localValidationTrigger(localValidationTrigger:Function):void; /** @inheritDoc */ public native function get localValidationTrigger():Function; /** @inheritDoc */ public native function set writeValueToProcessTrigger(writeValueTrigger:Function):void; /** @inheritDoc */ public native function get writeValueToProcessTrigger():Function; /** @inheritDoc */ public native function get readOnlyValueExpression():ValueExpression; }
The following types can be passed to the process definition and can therefore be used as field values:
Boolean
Blob
Date
Group
Integer
Link
String
User