Used for handling process-related events in simple standard cases without writing Java code. It allows you to flexibly restrict process-editing rules and automatically executed operations in the configuration. Implemented by one or more rules in the process type configuration with the following structure:

onProcessEvent.{@inc:cnt}.events=<EVENTS>
onProcessEvent.{@cnt}.eventsExclude=<EVENTS_EXCLUDE>

# if the class if defined, then the rest of keys is not used
onProcessEvent.{@cnt}.class=<CLASS_NAME>

onProcessEvent.{@cnt}.doExpression=<DO_EXPRESSION>
# optional
onProcessEvent.{@cnt}.ifExpression=<IF_EXPRESSION>
onProcessEvent.{@cnt}.checkExpression=<CHECK_EXPRESSION>
onProcessEvent.{@cnt}.checkErrorMessage=<CHECK_ERROR_MESSAGE>

Where:

  • <EVENTS> - events handled by the rule, separated by semicolons; if the key is omitted, all events related to the given process type are processed;

  • <EVENTS_EXCLUDE> - events excluded from rule processing, separated by semicolons; if the key is omitted, no events are excluded;

  • <CLASS_NAME> - a Custom class implementing org.bgerp.app.event.iface.EventListener and performing all the logic;

  • <IF_EXPRESSION> - a JEXL condition expression that runs the <DO_EXPRESSION> when satisfied;

  • <CHECK_EXPRESSION> - a JEXL condition expression; if it evaluates to false, an error <CHECK_ERROR_MESSAGE> is generated and used only together with checkErrorMessage;

  • <CHECK_ERROR_MESSAGE> - the error text reported when the <CHECK_EXPRESSION> condition fails;

  • <DO_EXPRESSION> - the executed JEXL script.

The previously used key commands is no longer supported and must be replaced with doExpression.

The following events are supported in <EVENTS>:

Event Description event class

statusChanging:<STATUS_IDS>

The process status is changing to one of the values whose IDs are specified as a comma-separated list in <STATUS_IDS>

ru.bgcrm.event.process.ProcessChangingEvent

descriptionAdding

Text is being added to the process description.

ru.bgcrm.event.process.ProcessChangingEvent

descriptionChanging

The process description is being changed in full.

ru.bgcrm.event.process.ProcessChangingEvent

executorsChanging

Process executors are being changed.

ru.bgcrm.event.process.ProcessChangingEvent

linkAdding

A link is being added to the process.

ru.bgcrm.event.link.LinkAddingEvent

linkRemoving

A process link is being removed.

ru.bgcrm.event.link.LinkRemovingEvent

paramChanging:<PARAM_IDS>

A process parameter whose code is specified as a comma-separated list in <PARAM_IDS> is being changed.

ru.bgcrm.event.ParamChangingEvent

statusChanged:<STATUS_IDS>

The process status has changed to one of the values whose IDs are specified as a comma-separated list in <STATUS_IDS>

ru.bgcrm.event.process.ProcessChangedEvent

created

Process was created.

ru.bgcrm.event.process.ProcessChangedEvent

createFinished

Process creation has been completed in the Wizard

ru.bgcrm.event.process.ProcessChangedEvent

createdAsLink

The process was created as linked to another process.

ru.bgcrm.event.process.ProcessCreatedAsLinkEvent

removed

Process was removed.

ru.bgcrm.event.process.ProcessRemovedEvent

descriptionAdded

Text was added to the process description.

ru.bgcrm.event.process.ProcessChangedEvent

descriptionChanged

The process description was changed in full.

ru.bgcrm.event.process.ProcessChangedEvent

executorsChanged

Process executors were changed.

ru.bgcrm.event.process.ProcessChangedEvent

linkAdded

A link was added to the process.

ru.bgcrm.event.link.LinkAddedEvent

linkRemoved

A process link was removed.

ru.bgcrm.event.link.LinkRemovedEvent

messageAdded

A new message was received in the process.

ru.bgcrm.event.process.ProcessMessageAddedEvent

paramChanged:<PARAM_IDS>

A process parameter whose ID is specified as a comma-separated list in <PARAM_IDS> has changed.

ru.bgcrm.event.ParamChangedEvent

The *ing events differ from the *ed events in that they are generated before the data is written to the database.

Rules are checked in the order of their numbers. The first rule that emits a message interrupts the check and cancels the process-related change.

JEXL

The JEXL processor receives Standard Process Context plus:

Examples

Add current user to executors and change status

Add the current user to executors and set the status to 40 when the process was created as linked to another process.

onProcessEvent.{@inc:cnt}.events=createdAsLink
onProcessEvent.{@cnt}.doExpression=addExecutors({user.getId()});setStatus(40, "")

Delete executor and group

With ID 2 and 37 respectively.

onProcessEvent.{@cnt}.doExpression=<<END
    deleteExecutors({2});
    deleteGroups({37});
END

Plugins

Following plugins provides JEXL objects with additional functions: