Switch

Overview

  • The Switch action is an advanced decision-making mechanism that efficiently handles multiple possible outcomes or conditions.

  • Unlike simple if-else conditions, the Switch action tests a single variable or expression against a predefined set of values. Based on which value matches the variable, the corresponding action is executed.

  • This method is especially useful when there are numerous possible outcomes, as it avoids repetitive and nested conditions, simplifying the workflow.

  • It is often used in situations where a workflow must take distinct actions based on user choices, status updates, or other distinct categories of input data.

  • Let’s explore the screens that follow, after drag-n-drop of Switch action on workflow canvas.

Config

image-20240817-180453.png
Config Tab

After clicking on + button, following screen for creating switch cases opens up.

image-20240817-180542.png
Switch Case Creation Screen

Switch Case Modal Field

Description

Switch Case Modal Field

Description

Label

A user-friendly name for the switch case, used for easy identification within the application.

Name

The unique identifier for the switch case, typically used in code or within merge text.

Filters

It enables to see toggle switches of AND & OR and add multiple conditions as much as you want and create a logic you desire to create a decision condition.

Add Condition & Group Condition

It enables to add conditions for filtering.

Add Condition & Group Condition

Condition

Description

Condition

Description

Add Condition

  • The Add Condition feature allows users to define multiple criteria that must be met for a validation rule to trigger.

  • This feature is used to create complex logic by combining different conditions that Salesforce evaluates before allowing a record to be saved.

Add Group Condition

  • The Add Group Condition feature allows users to group multiple conditions together, creating complex logic that involves different sets of criteria.

  • This feature is particularly useful when combining conditions that should be evaluated as a unit (logical OR within a group) or when nesting conditions for more advanced logic.

Add Condition Explained

After clicking on + button, following screen for adding condition for switch case opens up.

Condition

Description

Condition

Description

Destination Type

It defines the target location, where the switch condition will be mapped with.

Note: By default, the Destination Type is model. Other options include variable, cookie key, and local storage key.

Reference: Destination Type

Model

When you select Model as the Destination Type, the Model field allows you to specify the exact model (such as a Salesforce Object) where the switch condition will be mapped. This ensures precise targeting for your switch action, allowing you to control where and how the switching is applied within your application.

Field

It defines the exact field or variable where values will be stored for mapping.

Operator

It is specifically operator value such as Equals, Not Equals, In, Starts With, Ends With, Contains.

Source Type

It defines the data which will be mapped for switch with destination field chosen earlier.

Value

The available options will change depending on the selected source type.

Destination Type

In noKodr, the term Destination refers to the location where you want to assign or add a value. It allows you to choose from multiple options for where the value should be applied or stored.

  • Multiple Options: You can select from various destinations based on your needs, ensuring flexibility in how and where data is assigned.

  • Value Assignment: Determines the target location for assigning values, which could include fields from models or other data storage points within the application.

Destination Type

Description

Destination Type

Description

Model

From this source, users can select a Model (Salesforce Object) field to be displayed as the destination type.

Variable

Here, users can select the destination type from variables such as Record ID, Is Disabled, Is Read only, or Is Visible.

Input Variable

Here, user can select the destination type from input variables created in the layout by him earlier.

User

Here, you can choose the label from user fields such as First Name, Last Name, Email, Name, Phone, or Session ID.

Device

It enables user to decide whether the action will be visible on the specific device type or not. Devices supported:

  1. Mobile

  2. Desktop

  3. Tablet

Source Type

Source Type

Description

Source Type

Description

Static

Use this option to provide a fixed static value.

Model

Choose the field from other models whose value you want to include.

Variable

Select from the variables created in the layout whose value you want to use.

Input Variable

Select from the variables created in the layout whose value you want to use.

User

You can also select fields from the current logged-in user in your organization to include in the merge.

Null

It enables us to assign null value to the Destination Type field we chose.

Blank

It enables us to assign blank value to the Destination Type field we chose.

Action Details

Input