Fluent Commerce Logo
Docs
Sign In

Adding a Ruleset to your Workflow

How-to Guide

Author:

Fluent Commerce

Changed on:

13 Dec 2023

Key Points

  • Adding a Ruleset via the UI
  • Adding a Ruleset via JSON

Steps

Step arrow right iconAdding a Ruleset to your Workflow

The Ruleset defines the Rules that are executed when a matching event is produced.

Adding a Ruleset via the UI

You can add new Rulesets via either an existing Ruleset list or via the Entity Workflow Swimlane.

The green icons represent one or more Rulesets.

No alt provided

Rulesets inside of the Status rectangles are triggered on that State, while those outside of a status transition the entity to the state in which it's line and arrow indicate.

No alt providedNo alt provided

Clicking on the green icon reveals a list of Rulesets configured within that state or transition.

No alt provided

Each Ruleset displays a Name, the Statuses for which the Ruleset applies, and a Trigger Description. In the above example, the Ruleset name is Create, and the current status is Created.

The Ruleset Name is required as part of the Event that would Trigger the Ruleset to run.

Clicking on a Ruleset Name brings up the Ruleset details on a slide-out panel from the right-hand side of the screen.

No alt provided

The Edit Ruleset screen has three sections:

  • Triggers
  • User Actions
  • Rules

Each of these sections can expand or collapse by clicking on the section header.


Adding a Ruleset via JSON

To add a Ruleset to a Workflow JSON, you must add a new Ruleset to the 

`Rulesets`
 Array of the Workflow Json that matches the Ruleset schema outlined below.

Ruleset schema

JSON Key

Value Type

Mandatory

Description

name

String

YES

Name of the Ruleset. The name cannot contain spaces. This name is used as matching criteria for Events.

description

String

NO

Cannot be more than 250 characters.

type

String

NO

The entity being processed.

subtype

String

NO

The 

`subtype`
 of the entity being processed. This can be used when you have multiple entity subtypes and you only want a Ruleset to triggered by one. 
`subtype`
 is required if the Ruleset has a User Action.

eventType

String

NO

There are three valid event types; NORMAL, EXCEPTION and GENERATED. Most eventTypes will be normal, however you can ues the EXCEPTION type for Rulesets that handle exceptions.

rules

String

YES

The array of Rules that will be run when this Ruleset is triggered

triggers

Array

YES

A list of statuses that will trigger this Ruleset.

userActions

Array

NO

A list of userActions in this Ruleset

Ruleset sample
1{
2  "rulesets": [
3    {
4      "name": "{{rulesetName}}",
5      "description": "",
6      "type": "{{entity}}",
7      "eventType": "{{eventType}}",
8      "subtype": "{{subtype}}",
9      "rules": [],
10      "triggers": [
11        {
12          "status": "{{statusName}}"
13        }
14      ],
15      "userActions": []
16    }
17  ]
18}

Language: json

Name: Ruleset sample

Description:

[Warning: empty required content area]
Fluent Commerce

Fluent Commerce

Copyright © 2024 Fluent Retail Pty Ltd (trading as Fluent Commerce). All rights reserved. No materials on this docs.fluentcommerce.com site may be used in any way and/or for any purpose without prior written authorisation from Fluent Commerce. Current customers and partners shall use these materials strictly in accordance with the terms and conditions of their written agreements with Fluent Commerce or its affiliates.

Fluent Logo