Follow

Advanced Automation Features

Similar to Strengthening, Automations also include an Expert Mode to enable additional choice and flexibility. This article will provide an overview of the various features and settings available in Expert Mode.

 

Enabling Expert Mode

 

To enable Expert Mode, open the Automations menu. Click the plus sign in the upper right hand corner to create a new automation, or click the pencil icon next to the automation you wish to edit.

 

Toggle on Expert Mode at the top of the automation creation dialog.

 

 

Run This Automation

 

The first difference you will notice in the Expert Mode view is that an additional section "Run This Automation" is included before the "IF" section. Three options are provided:

  • Always (default)
  • When Zapp runs in foreground
  • When Zapp runs in background

 

Running automations only in the foreground is useful for automations that are intended to enhance user experience (i.e. copying data between controls) but are not necessary for push notifications, which rely on the Zapp periodically running in the background on the user's device, to function properly.

 

Running automations only in the background, on the other hand, is useful for automations that enable, for example, filtering a table that triggers push notifications but are not needed during user interaction.

 

Automation Trigger (IF)

 

In addition to choosing your automation trigger as normal (i.e. any connection, some connections, internal), expert mode also enables you to set an additional automation condition. The condition is a script that should return a true or false value.

 

 

For example, the below script tells the Designer that the automation should only run if the text field "amount" has been filled with a value greater than 1,000.

 

context.getControl("amount").text>1000


Please see the article on the Web Control Scripting API for more information.

 

For easier view of the script input field, a full screen JavaScript editor is available by clicking the expand icon.

 

 

 

You may click the page-and-gear icon on the right to evaluate your script for any errors and obtain its current value (true or false).

 

 

Automation Step (THEN)

 

In addition to choosing a control, Expert Mode includes two additional options for the automation steps:

  • Refresh
  • Script

 

Choosing "Refresh" will simply refresh the Zapp page. This is useful in cases where data in the source application may have been updated, and you would like to refresh the user's view.

 

Using a script enables you to perform more complex actions based on our Web Control Scripting API. For example, the below script prefills a text field with the average cost per item based on the values input into two other fields.

 

var itemCount = context.getControl("items").text;
var totalCost = context.getControl("cost").text;
var perItem = context.getControl("per");
perItem.setText("The average cost per item is" totalCost/itemCount).then(resolve);

 

As with non-expert mode automations, multiple automation steps can be specified.

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.