Salesforce

Handling the Same Event with More Than One Handler (Magic xpa 4.x)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

Handling the Same Event with More Than One Handler (Magic xpa 4.x)

In some cases you have more than one handler for the same event.

Magic xpa's default behavior is that each raised event will be handled by the first handler (according to Magic xpa's rules) and after that the event will be cleared. So, no other handler (if one exists) will handle this event.

For example, let's take a scenario where we have two handlers for a Print user-defined event, one that prints the customer order and one that prints an invoice for the order. According to Magic xpa's rules, only one of them will handle the Print event.

Which handler will handle the event?

According to Magic xpa's rules the lowest handler in the execution tree will handle the event. For the above example this means that if you create the Customer Order printing handler after (physically lower in the Logic Editor) the Invoice printing handler, the Customer Order printing handler will handle the Print event.

What if I want both handlers to handle the event?

For the above example, if you want both of the handlers to handle the event, you should set the Propagate property in the Customer Order printing handler to Yes. This instructs Magic xpa to keep the Print event raised after the Customer Order printing handler is completed.

Can I add additional code to internal handlers?

You cannot access a Magic xpa internal handler. However, you can set an Event logic unit that will handle the internal event before the Magic xpa internal handler.

You can do this, because Magic xpa internal handlers are always the highest handlers in the execution tree.

Let's take for example the handling of the Exit internal event.

If you want to "ask" the end user if they want to print the customer order before leaving the program, you need to handle the Exit internal event. But, if you handle the Exit internal event, then Magic xpa will not handle the Exit internal event, and therefore the program will never be terminated. In order to handle the Exit internal event and also instruct Magic xpa to handle this event, you need to specify Propagate = Yes in the handler you defined (the one that "asked" the end user if they want to print the customer order).

Related Topics

How Do I Handle the Same Event Using Several Handlers?

Reference
Attachment 
Attachment