Pre Submit Example

Parent Previous Next

Pre-Submit Handler Example


If the form is embedded in IYOPRO.PLM.Components as a workflow start form, a function in IYOPRO.PLM.Components

can be invoked to process the form data prior to the form submission.


The protocol used with IYOPRO.PLM.Components expects a string that contains a python dictionary as data.

This dictionary contains a key to define the function to executed and a parameter to control which form variable

should be provided to function.


Pre-Submit Example Data


{ "TYPE" : "FB", "NAME" : "IYOPRO.PLM.TEST.PRESUBMIT", "FBPARAMETER" : "Text" }


This would instruct IYOPRO to call the hosting IYOPRO.PLM.Components application when the submit function of the form is invoked.

As part of the of this call the above text is transferred.

IYOPRO.PLM.Components decodes the information and obtains the value of the form variable specified by "FBPARAMETER".

This value is passed to the function module (TYPE="FB") with the name "IYOPRO.PLM.TEST.PRESUBMIT".


The function module itself processes the data and optionally returns information to the form.

For example the value of the text variable can be changed and an information, indicating the the form data was already processed, is set.


IYOPRO.PLM.Components Example function module


! IYOPRO.PLM.TEST.PRESUBMIT

! ------------------------------------------------------------------------------------------------

! Example of a synchronous call form the IYOPRO web client via the pre-submit handler

! Parameters:

! P1 = (IN) Dictionary of the form data

!           Not all expected key might be present, depending on the form values

! P2 = (IN) Variable name

!           Set this variable with a string representing a Python dictionary.

!           Keys are the form variable names and their respective values (as JSON) to be modified.


LOCAL FORMDATA[]

CREATE ARRAY FORMDATA FROM P1 OPT 'PYTHON'

SET ARR FORMDATA ROW -1 COL ACOLUMNS(FORMDATA)


LOCAL TXT

TXT = FORMDATA[0='Text'][1]

TXT = 'Pre-Submit-Handler(' + TXT + ')'


LOCAL RET

RET = '{ "Text" : "\"'+TXT+'\"", "PROCESSED" : "\"Yes\"" }'

EXEC P2+'=RET'



Another typical usage is that within the form there is a checkbox, allowing the user to specify if he wants to have the form

data processed directly in the application embedding the form or by the workflow.

Depending on the value of the checkbox the function triggered by the pre-submit handler would either perform the processing or do nothing.

Likewise the workflow either perform the processing or skip it.


Thus the user can decide if a time consuming operation is to be performed while he waits (within the pre-submit handler of the

hosting application) or asynchronous by the workflow.