Raising event from the definition

Feb 9, 2009 at 6:08 PM
I have a statemachine definition that allows has multiple path ways to cancellation. What I plan to do is to be able to trigger certain action depending on how the case is cancelled. One that I am thinking is trying to implement raising an event after all the task in the new state is executed. Something like

state @RequiredApprovalsRejected:
@Cancel >> @CancelledAtRequiredApproval
        assign_call_task "Approval Rejected", """Case {CaseNumber} approval has been rejected. Please notify to pick up original """ , 20
        raise @Cancel

This way I can make a custom task call at @CancelledAtRequiredApproval on on_enter_state. Is ther any way to achieve this?

Original Definition :
state @RequiredApprovalsWaitingForResultsOnHold:
    when @RejectApprovals >> @RequiredApprovalsRejected
    when @AcceptApprovals >> @PaymentPending 
state @RequiredApprovalsRejected:
    when @Cancel >> @Cancelled
    #on_enter_state @CallTrigger, "Cancel"
    assign_call_task "Approval Rejected", """Case {CaseNumber} approval has been rejected. Please notify to pick up original """ , 20
state @PaymentPending:
    when @PayFee >> @LicensePrintingPending
    when @Cancel >> @Cancelled
    assign_call_task "Pay Initial Fee", """Case {CaseNumber} has pending payment. Please come to the office to pay. """ , 20

state @LicensePrintingPending:
    when @PrintLicense >>  @LicenseWaitingOnSignatureHold
    when @Cancel >> @Cancelled

Coordinator
Feb 15, 2009 at 4:03 AM
There are a few ways to skin this cat. Probably the most straightforward would be to use the just added "event action" feature that allows actions to be fired in response to individual events, instead of simply state transitions, like this:

state @RequiredApprovalsRejected:
    when @Cancel >> @Cancelled
    on_event @assign_call_task "Approval Rejected", """Case {CaseNumber} approval has been rejected. Please notify to pick up original """ , 20
state @PaymentPending:
    when @PayFee >> @LicensePrintingPending
    when @Cancel >> @Cancelled
    on_event @assign_call_task "Pay Initial Fee", """Case {CaseNumber} has pending payment. Please come to the office to pay. """ , 2

You will need to download the latest version to be able to use this feature.
Feb 15, 2009 at 6:59 PM
Brilliant. Thank you so much.