Topics and lessons

Using different logic on Main and Lab

You might want to use different settings or values in your Lab and Main environment.

Examples are:

- the From and BCC-addresses in email messages;

- a flag that allows the system to send emails;

- URLs that differ in Lab and Main;

- the current year (for testing purposes);

- interface tokens (Zapier, Stripe etc.);

- defining the environment (lab/main), so you can create different paths in flow parts based on the environment.

To do so, in this lesson you'll learn to:

  1. Create the data item
  2. How to manage the application settings
  3. Manage application settings
  4. Use the application settings

1. Create the data item

Start with creating a data item called Application settings to store those properties. During the execution of a user flow or flow part you can look up these settings after which the flow can use them.

  1. Go to Design and then Data.
  2. Add the data item.
add-data-item
  1. Add properties. You can add properties that might be different in either environment. Examples are:
add-properties

2. How to manage the application settings

Create a user flow as below to make sure that both in Lab and Main you have exactly one item in which the values for Lab or Main are stored. Before you create the user flow, you create a flow part that counts the number of items in Application settings and add this check to the Application settings user flow.

Create the flow part that counts the items in Application settings

  1. Create a flow part and rename it to Applications Settings count items.
  2. Create a look up on Application settings with a list as outcome.
  3. Create a calculation that counts the number of items in the look up.
  4. Output the result of the calculation.
flow-part-application-settings

Create the user flow Application settings

  1. Create the user flow Application settings.
  2. Using the user flow wizard, create a user flow for Application settings allowing Add, Delete and Edit.
  3. Insert the flow part you just created right after Start. It will count the number of items in Application settings.
  4. Modify the Add button to use an additional rule: Number of items in Application settings < 1. This means that only when there is no item yet, you can add one.
  5. Modify the Delete button to use an additional rule: Number of items in Application settings > 1 (you don’t want to delete your precious application settings inadvertently).
  6. Reroute Delete Application settings to Application settings count items.
  7. Insert a page after the flow part: Warning: there is more than one item, delete excess items.
user-flow-application-settings

The additional rule for the Add button:

additional-rule-add-button

The additional rule for the Delete button:

additional-rule-delete-button

3. Manage application settings

After you’ve published the design, you can manage the application settings. In both the Lab and Main environment you can enter the environment-specific values and use them in your application.

Using the example above, the settings might look like below:

add-application-settings

4. Use the application settings

There are two ways to make use of the application settings:

1. The values in the Application settings data item are specific to the environment, or,
2. The environment you are in defines the routing in the flow.

The values in the Application settings data item are specific to the environment
This might be the case for interface tokens, urls and email addresses. Another example is that you only want Triggre to send test messages in the Lab environment.

The routing in a flow depends on the Triggre environment
In example below, depending on which environment it is, Triggre will calculate an Email to address and a Subject for the email message.

After that, the Data flow composes the email, using the values it calculated in the appropriate branche.

  1. Create a look up in the flow part on Application settings.
  2. Do not use a rule.
  3. Select A single Application Settings.
  4. Do not sort.
  5. Give the look up a name.
  6. Depending on the value of Application settings | Triggre environment, calculate the Email to and the Subject.
  7. Then create a Send Email. Use the calculation Email to and the Subject (Triggre will automatically use the one based on the route followed) and retrieve the From and BCC from the Application settings.

The flow part:

user-flow-application-settings

The animation:

flow-part-animation