Form Scripts

Form scripts can be used for both Forms created with the Online Form Designer and custom forms created as .ASCX files.

To develop Form Scripts inside Visual Studio, use the fully functional Visual Studio project installed with the product, which is bundled into a ZIP archive named bpVS.zip. This ZIP file is located in the c:\Program Files\BP Logix\Process Director\ directory by default. You can copy this utility to any computer that runs Visual Studio 2013 or higher. Cloud customers can download the plugin from the Downloads section of the BP Logix support site.

Refer to the sample files eform_*.ascx, as well as the SamplePage.aspx file referenced in the Custom ASPX Pages section of the documentation, below.

Scripts for Forms created with the Online Form Designer should be placed into a separate .ASCX document in the Content List. Here is the structure for this type of script:

<%@ Control Language="C#" AutoEventWireup="false"
    Inherits="BPLogix.WorkflowDirector.SDK.bpFormASCX" %>
<script runat="server">
    // Events...
</script>
<script>
    // Insert client-side JavaScript code and functions here...
</script>

Scripts for .ASCX Forms are typically placed in the same file as the .ASCX source form. Here is the structure for this type of form:

<%@ Control Language="C#" AutoEventWireup="false"
    Inherits="BPLogix.WorkflowDirector.SDK.bpFormASCX" %>
    // Actual Form contents...
<script runat="server">
    // Events...
</script>
<script>
    // Insert client-side JavaScript code and functions here...
</script>

Form Script Events #

In both cases, the APIs and events available are the same. All events will be called with the following environment:

LOCAL VARIABLE

DESCRIPTION

CurrentForm

Reference to the current Form instance object

CurrentUser

Optional instance of the current User object

CurrentPartition

Instance of the current Partition object

CurrentWorkflow

Optional instance of the current Workflow object(Deprecated)

CurrentWorkflowStep

Optional instance of the current WorkflowStep object(Deprecated)

CurrentWorkflowStepUser

Optional instance of the current WorkflowStepUser object (Deprecated)

CurrentProject

Optional instance of the current Project object

CurrentProjectActivity

Optional instance of the current ProjectActivity object

CurrentProjectActivityUser

Optional instance of the current ProjectActivityUser object

bp

The bp environment

bpEventHandle

The class that holds information about the event that generated postback

bpEventHandle.EventType

The type of event

bp.EventType.User – A custom button was hit

bp.EventType.Complete – A process complete button was hit

bp.EventType.Cancel – The cancel button was hit

bp.EventType.Save – The Save button was hit

bp.EventType.SaveAndClose – The Save and Close button was hit

bp.EventType.Print – The Print button was hit

bp.EventType.CancelClose – The Cancel process button was hit

bpEventHandle.EventName

The name of the control that initiated the postback

bpEventHandle.EventControl

The actual FormControl of the control that initiated the postback

bpEventHandle.EventControl.ArrayNum

The array row number of event, or 0 if event was not caused inside array.

The Form life cycle has the following event callbacks:

<%@ Control Language="C#" AutoEventWireup="true"
    Inherits="BPLogix.WorkflowDirector.SDK.bpFormASCX" %>
<script runat="server">
// These methods are optionally overridden to allow custom script
// to be inserted into the Form life-cycle.

// Called 1 time per form instance to initialize form fields

protected override void BP_FormInitialize()
{
}

// Called first time in ViewState that form is displayed

protected override void BP_ViewStateInit()
{
}

// Called for every event control and complete button
protected override void BP_Event(bp.EventType pEventType,
                                 string pEventName)
{
}

// Called prior to processing rules
protected override void BP_Rules()
{
}

// Called after processing rules
protected override void BP_Rules_Post()
{
}

// Called prior to completing before internal validation
protected override void BP_Validation()
{
}

// Called prior to completing after internal validation
protected override void BP_Validation_Post()
{
}

// Called prior to saving form data and closing form
protected override void BP_Completed()
{
}

// Called just prior to displaying a form
protected override void BP_Display()
{
}
</script>

These methods are optionally overridden to allow custom script to be inserted into the Form life-cycle:

EVENT

DESCRIPTION

BP_FormInitialize()

Called 1 time per form instance to initialize form fields

BP_ViewStateInit()

Called first time in ViewState that form is displayed

BP_Event(bp.EventType pEventType,
    string pEventName)

 

See sample above for example.

Called for every event control and complete button

pEventType:

The type of control that caused the event

bp.EventType.User

A user event from a form control

bp.EventType.Complete

One of the complete buttons on a form

bp.EventType.Save

Save form data

bp.EventType.SaveAndClose

Save form data and close form

bp.EventType.Print

Print form

bp.EventType.CancelClose

Cancel process or Form submission

bpEventName

The ID of the form control that caused the event

BP_Rules()

Called prior to processing rules

BP_Rules_Post()

Called after processing rules

BP_Validation()

Called prior to completing before internal validation

BP_Validation_Post()

Called prior to completing after internal validation

BP_Completed()

Called prior to saving form data and closing form

BP_Display()

Called just prior to displaying a form