Adding a Ruleset to your Workflow
Author:
Fluent Commerce
Changed on:
13 Dec 2023
Key Points
- Adding a Ruleset via the UI
- Adding a Ruleset via JSON
Steps
Adding 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.
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.
Clicking on the green icon reveals a list of Rulesets configured within that state or transition.
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.
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`
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
|
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]