Salesforce

How Do I Prevent an Internal Event (action) like Delete Line, from Occurring? (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Prevent an Internal Event (action) like Delete Line, from Occurring? (Magic xpa 3.x)

Magic xpa has a lot of built-in functionality, which saves you a lot of time. Common actions, like Create Line, Delete Line, and Exit are built into the engine and you do not need to specifically code them.

You can block these events at a system level, by changing the default keyboard mapping and menus. You can also redefine some of the events in Task Properties->Options. But you have more control and more options, at a task level, by coding a logic unit that intercepts the internal event.

In this example, we will block the delete line action if the status of an order is not ‘N’ (New).

Blocking an internal event

Here is a logic unit that will block the Delete Line event, if the Order Status <> ‘N’. In this logic unit you might want to do something like give a message to the user, but that is not required to do the blocking. Below we will go through how to enter this event, step by step.


  1. In your task, click on the Logic tab (Ctrl+1).

  2. Move to the line where you want to enter your logic unit.

  3. Press Ctrl+H to create a logic unit header.

  4. Select Event for the header type.

  1. A dialog box will appear. For Event type, select Internal. Then tab to the next field, Event.

  1. After you tab, an Events list dialog box will appear.

    You can select the event you want by typing in the first letters of the event. In this case, typing “del” will get us to the delete events, then we can arrow down to “Delete Line”.

    After you find the event you want, click the Select button, or the Enter key.

  1. Press Enter again to close the Event dialog box.

  1. You now have an Event logic unit which will execute when the Delete Line event happens.

    To keep the event from propagating, go to the Event Properties pane (Alt+Enter), and set Propagate to No.

  1. You will probably also want to set the Scope to “Task”, because usually you would not want to trap the Delete Line event at a lower task level.

  1. At this point the logic unit will be executed whenever the Delete Line event occurs, and trap it.

However, we also wanted the event to only be trapped if the status code was not ‘N’.

To do this we zoom (F5, double-click) on the Condition field.

This brings up the Expression Editor. You can zoom from the Expression to find the variables you want, or Right-Click to find functions (See How Do I Format an Expression in the Expression Window?).

Now you are done! You can add more logic to your logic unit, such as this warning message we added here.

See also

How Do I Work with the Magic xpa Engine as an Event-Driven Engine?

The Online and Rich Client Samples projects (program EN03 and REN03)

Reference
Attachment 
Attachment