Skip to Main Content

Breadcrumb

Overview

The FOS - Trigger Event dynamic action plug-in is used for controlling the branching logic (if/then/else) within a dynamic action. It gives you/developers the declarative ability to fire custom event(s) which other dynamic actions can listen to, whilst giving you the option to cancel the following actions in the current dynamic action. Hence why we use the term branching.

Conditional Event Firing

The plug-in has the added flexibility of allowing you to define a client-side condition as to whether you fire the event. It is somewhat similar to our "FOS - Client-side Condition" dynamic action, but provides more focus on branching of logic through the firing of events.

Multiple Events

You can also fire multiple events by comma separating them, as well as defining the "data" object that is passed into the event in case you need to transfer extra information. Why wouldn't I just use multiple actions instead? Our goal is to focus on efficiency and reduce the overall number of actions that developers create. Since we're firing an event already, we thought we should give you the ability to fire multiple events.

Examples

Custom Event

You can fire custom events against a single or multiple affected elements defined in your dynamic action. The plug-in offers a simple or advanced configuration. In the custom event examples we used an advanced configuration to set a page item with the event name so we can tell which event is firing in the notifications. You could use this item value in your conditional logic as we show in the "Conditional Event Triggering" demo below.

Event Data

You can pass text or an object into the "data" object which can be accessed in your dynamic action that listens to the custom event using "this.data".

Cancel Following Actions

This action can be used like branching logic so you can avoid actions running after triggering an event e.g. just like you can redirect to a page using page branches.

Conditional Event Triggering

You have the ability to provide a condition to determine whether you fire the event or not. These conditions allow you to use additional logic to determine if an event really needs to fire. For added flexibility, you can optionally specify an alternative event name to fire when the condition evaluates to FALSE.

This conditional logic is determined client-side in the browser at the time of execution. You have a number of built-in condition checks, the same ones that APEX provides in the actual dynamic action "Client-side Condition".

You can use the page items below to control whether the event fires or not e.g. for the checks to work please change the page item value and condition value according to the test you want to check.


Additional Conditions

In addition to regular client-side conditions we have included several additional page API checks. The following conditions can be used to control whether the following actions continue:

  • Page is Valid
  • Page is Invalid
  • Page has Changed
  • Page has not Changed

Note: these conditions are based on the Javascript API that APEX provides, so you can be safe in the knowledge that you are using something well tested and used. We also welcome user feedback as to what other conditions you would like us to include, so please let us know.

Design

You can preview the plug-in setup as you would see it in page designer. You can either do this by clicking this button in the top right corner of each example, or you can see all the examples together in the region below.

Looking at the examples you'll see just how easy the plug-in is to use. Don't worry about changing any values as they aren't saved. We actually encourage you to change them, so you can see the behaviour of the attributes and their help text.

FAQ

  • Does it matter if I use upper or lowercase for my event names?

    No it does not matter what case you use for your event names, it's a personal choice. The preferred standard though is to use lowercase and use "-" hyphens for spaces to make them easier to read. We suggest that you just stick to letters and hyphens and no other special characters. Note: if you use a "." in your event name you will be defining a namespace. Please see the following documentation for more information on event namespaces.

  • Why do you provide an "Advanced Configuration" option?

    You might think we provide too many settings for our plug-ins. In our experience we have run into many situations where hit limits with existing functionality and have to resort to writing Javascript code. We prefer the declarative nature of APEX as we don't need to support the code that APEX provides us. So when we create plug-ins we want you to have the ability to do what you need to do declaratively without having to resort to custom code. This means that you don't need to resort to writing code and can rely on us to support the plug-ins we provide, saving you valuable time.

    Of course all these settings can seem a little overwhelming to novice developers, but in most cases it is greatly appreciated by experienced developers. We do our best by providing trying to separate the functionality for novices and experienced developers by providing an "Advanced Configuration" setting.