Thursday, 8 December 2011

Right-Click Cancel on Processes

Right-clicking on a Process in My Action List shows a handy Cancel pop up menu. Using this short cut can be much quicker than opening the Process and then cancelling from within a new page.
Cancel a Process from the Action List

For a right-click cancel to work, the Process must contain a path that leads to an end point without intervening steps.

Right-click cancel possible - A Process with a route to an end point with no steps (the bottom "Cancel" route)

Right-click cancel not possible - A process without a "no-step" route to a end point 

When a Process does not contain a route without intermediate steps, an error is show when attempting to cancel from the Action List.

Error message from a failed right-click Process cancel
However, intermediate steps are sometimes required when cancelling a Processes to perform certain tasks or return to a previous state. Unlocking records or freeing up resources for example. Rather than adding a step and preventing a right-click Action List cancel, the code that would be in the step can be written in the Else rule before the end point.

The Else rule (selected in blue) before the end step

This way, clean-up functionality can still run when the user cancels from the Action List.

Tuesday, 6 December 2011

Process Else Rules - Accessing the DataObject in Code

Within the Code tab of a Process, the Base Object can be accessed as a property. For example, the evaluation of CUSTOM rules can sometimes require a decision to be made based on a value contained within the Base Object.
Access to the ProfMaster Base Object from a custom rule in Process code
Function Evaluate As System.Boolean
Return Me.IM_AutoBillEdit.IsOutsideProcess.Value(False)
End Function

However, this Base Object property is not accessible in Else rules. To access it, cast Me.Process to its type and then access individual objects though the object collection.
Access to the ProfMaster Base Object from an ELSE rule in Process code
Public Overrides Sub OnRule()
For Each profMasterItem As ProfMaster In _
CType(Me.Process, NextGen.Application.Process.ProfProcess). _
ProfMasterCollection

NextMessage = profMasterItem.Description
Next
End Sub