Skip to main content
Version: v10.15

Timer Action

Timer action can be used to trigger events repeatedly at timed intervals.

Action Creation

  1. To create a Timer Action:
    • Select the Action option from Variables on the Workspace Toolbar and click New Action from the Actions dialog.
  2. New Action wizard will open.
    1. Choose Timer Type
    2. Name - set by default which can be modified
    3. Owner - the scope of the Variable being created. By default it is set to Page, you can change it to Application if you want this variable to be available across the app.
    4. You can set the Properties (know more)
    5. Click Done to create the Action
  3. You will be directed to the Actions dialog, with the new action listed. As you can see:
    1. a Timer Action is created,
    2. the properties tab contains the behavior properties. Know more about properties.
    3. the events tab will contain the events that can be configured to trigger any action. Know more about events.

Properties

Timer Variables are special variables that can be used to trigger a particular event at regular time intervals.

PropertyDescription
Behavior
Trigger on page loadSelecting this option will ensure that the timer starts at page load.
Trigger after a delayDefines the time delay, in milliseconds, before triggering the specified event.
Repeat after delaySpecifies whether the timer is one-time or a repeating event.

Events

Once a Timer Action is triggered, if it is Page scoped, then the action (and its repeating event) is destroyed when you navigate away from the page. If it is App scoped, it has to be manually stopped through cancel method.

  1. on Timer Fire: This event will be triggered on the completion of the timer. If the Delay property on the Timer Action is set then the event is invoked after the milliseconds of time supplied in ‘delay’ property of the timer action. The event is invoked once if ‘repeating’ flag is off and repetitively after every ‘delay’ milliseconds if ‘repeating’ flag is on. The repeating Timer Action event can be stopped in either of the two ways:

    1. Calling the cancel method on the Timer Action through the script at any point in time.
    2. If it is Page scoped, the action (and its repeating event) is destroyed once you navigate away from the page. If it is App scoped, it has to be manually stopped through the above step.

    Usage Examples:

    You can assign a Variable (or multiple Variables) or a Javascript method with custom logic in for dynamic behavior as required.

  2. Call a Variable that fetches the updates from Employee database with the latest after every 30 seconds.

  3. A Variable that gives Facebook-like feeds after a certain timestamp. Assign Javascript to the onTimerFire event and write following logic. Once the Timer Action is triggered, if repeating property is set, then the variable will be invoked after every delay milliseconds.

    Page.timerAction1onTimerFire = function(variable, data){ // set the dynamic input on the variable Page.Variables.WebServiceVariabe.setInput('timestamp', Date.now()); Page.Variables.WebServiceVariabe.invoke(); };

Methods

invokecancel

invoke(object, success callback, error callback)

This method invokes the timer variable

Parameters:

  • options: object with no fields, an empty object has to be passed
  • success: callback
  • error: callback

Return Value: None

Example:

Page.Actions.timerAction1.invoke();

cancel()

This method aborts the timer variable.

Parameters: none

Return Value: none

Example:

Page.Actions.timerAction1.cancel();

< Variables & Actions

  1. Data Integration - Variables