Workflow Scheme

Scriptable Workflows have a dedicated screen area for the workflow user interface design and four areas for the script design.

Form Designer

The Form designer is built for designing the workflow user interface displayed on the MFP. It serves as a visual aid in composing the workflow UI. It features both a Design view (graphics) and  a Code view (scripting for event handlers of the form controls).

If you start out from Design view, you have to add the required control elements available on the left of the designer window.

These control elements, from top to bottom, stand for:

Simply drag-and-drop the selected control type to the desired slot in the form designer window. When in place, the controls can still be rearranged via drag-and-drop. The control element in place appears in the following format:

<Label for [textbox_1]> textbox_1

You can edit the control label by double clicking it. Click outside the editing box or hit Enter to confirm the new label.

When hovering over the control item, there are two options you can configure for your control:

Click the trash can icon to delete your control. Click the lightning icon to enable one or more event handlers related to the control. The event handlers are scripts executed whenever the specified event happens. The value of the control is changed by editing, selection is made in a list-like control. When the value of the control is changed, or the focus moves to the control or out from the control, a search must be performed.

The following options are available:

Note: 

Depending on their type, each control element has a different number of behavior type. The label control does not have an event handler, it can only be deleted.

When the control elements are in place, they are displayed on the scriptable form preview.

After you select a control event, the Form designer automatically switches to Code view, where the selected behavior is included in the code. Alternatively, you have to write the behavior specific script it will use. When the script is complete, click Check to test the script.

If there is any invalid character or piece of code in the window and you click Check, an error message is displayed.

The default script format is the following:

public Result EvalCode(ICommunicationObject io)

{

return Result.Ok;

}

The ICommunicationObject io class provides access to the following members:

public interfaceICommunicationObject

    {

        bool HaveToCreateOutputDocument { get; set; }

        ITypedLogger Logger { get; set; }

        List<string> OutputDocuments { get; set; }

        string ProfileName { get; set; }

        IPublishing Publishing { get; set; }

        string RequestText { get; set; }

        string ResponseText { get; set; }

        string ErrorText { get; set; }

        T Get<T>(string name);

        void Set<T>(string name, T data);

        ScriptableWorkflowState State { get; set; }

        Form Form { get; set; }

    }

 

The members stand for the following:

Initialize Form Script

Under the Initialize Form tab, you can write a script that initializes the Scriptable form. If you are at any other location within the Scriptable Workflows configuration, you can get to this section by clicking the Initialize Form Script workflow item arrow in the workflow item list.

Write a script here if you want to:

Note: 

If you place a Combo box element into the Form designer along with the following script into the Initialize Form Script tab, 'Cannot communicate with the ShareScan Manager' message occurs.

FmlElementBase listaelem = new Item();

listaelem.Id="1"; //it's a must, if ID is empty, exception occurs.

ComboBox cb = new ComboBox();

cb=io.Form.GetControl<ComboBox>("dropdownlist_1");

cb.ItemsDictionary.Add(listaelem);

If the instantiation happens from ListBoxItem() instead of Item(), the script functions properly.

Validate Form Script

Under the Validate Form Data tab, you can write a script that validates the date specified by the user on the Scriptable form. If you are at any other location within the Scriptable Workflows configuration, you can get to this section by clicking the Validate Form Script workflow item arrow in the workflow item list.

Store Result Script

Under the Store Workflow Results tab, you can write a script that stores the final workflow results. If you are at any other location within the Scriptable Workflows configuration, you can get to this section by clicking the Store Result Script workflow item arrow in the workflow item list.