Fluent Commerce Logo
Docs
Sign In

Adding a Rule to your Workflow

How-to Guide

Author:

Fluent Commerce

Changed on:

30 Jan 2024

Key Points

  • Working with Rules
  • Adding a Rule via the UI
  • Adding a Rule via the Workflow JSON

Steps

Step arrow right iconAdding a Rule to your Workflow

Working with Rules

Rules are the fundamental building block of Workflows. They are the "Lego pieces" of business logic that can be pieced together in various combinations to achieve the desired outcomes.

Rules in most cases require specific input parameters in to execute their intended logic. These will be displayed in the UI, or added as `props` in the WorkflowJson, and provide a mechanism with which to capture the values. Where possible in the UI, these will be data type relevant. For example, the Change State provides a drop-down selector presenting all valid States for the current .

The Rules in a will be executed in the displayed in the UI or appear in the JSON, from top to bottom.

Adding a Rule via the UI

No alt provided

Opening a and clicking the Add Rule button brings up the Library panel on the left of the panel. A list of all available Rules is provided, based on which Plugins are installed and Active for the given and .

The Search box enables users to quickly find the Rules they are looking for. It filters the List as you type. The list will only show Rules that support the 's .

Clicking on a within the list will add it to the Rules section, in readiness for configuration of required input parameters.

You change the of the Rules in the by drag and drop, however one should take precautions here, since the outcome of a may invoke an incompatible with the next .

To remove a , click the Trash Can icon on the right side of the , visible on mouseover.

You can add, change, or remove Rules in this section, as well as use drag and drop to change the of execution.

Most Rules will provide input areas for their required parameters or configuration. For example, the Change State requires the new Status to be provided, so that the knows what state to change the to.


Adding a Rule via the Workflow JSON

Add your Rules to the `Rule` array in the you want to them. They will be triggered in the , from top to bottom.

Rule schema

JSON Key

Value Type

Mandatory

Description

name

String

YES

Full name of the including the and name. For example "{{accountName}}.{{pluginName}}.{{ruleName}}"

props

JSON Object

NO

Props are required for the . These differ depending on the values the needs to function. See the Rule Library for information about specific Rules and their props.

Rule sample
1"rules": [
2    {
3        "name": "{{Rule name}}",
4        "props": {}  
5    }
6],
Fluent Commerce

Fluent Commerce