Fluent Commerce Logo
Docs

CreateCategory

Rule

Changed on:

12 Aug 2025

Overview

Creates a category based on the information passed in the event
Plugin NameInventory Reference Module
Namespace[[account.id]].globalinventory
The Inventory Reference Module is the foundation for inventory related implementations. It provides reference Workflows for inventory ingestion and processing. Extensible by design, use this Module as a base to build a solution to the needs of your customers.The Inventory Module includes the following areas:
  • Product Catalogue workflow
  • Inventory Catalogue workflow
  • Control Group workflow
  • Virtual Catalogue workflow

UI Description

Creates a category based on the information passed in the event

Accepts

  • PRODUCT_CATALOGUE

Actions

  • This rule produces a MutationAction that will create a new category.

Rule parameters

This rule has no Input Parameters.

Event attributes

Main Event Attributes
ParameterDescriptionData TypeRequired?
refThe ref of the categoryStringRequired
typeThe type of the categoryStringRequired
nameThe name of the categoryStringRequired
parentCategoryThe ref of the parent categoryStringOptional
summaryA brief summary of the categoryStringOptional
attributeExtra attributes that may be used as part of this category. See the table below for the definition[Attribute]Optional
Attribute type sub-attribute
ParameterDescriptionData TypeRequired?
nameThe ref of the categoryStringRequired
typeThe type of the categoryStringRequired E.g STRING, INTEGER, BOOLEAN, OBJECT
valueThe name of the categoryStringRequired

Exceptions

If child categories are provided to be created as part of this category, an IllegalArgumentException will be thrown. This is because child categories cannot be created at the same time as their parent category. They need to be created separately. If `{ref}` or `{type}` event attributes are null or empty, an EventAttributeNotFoundException will be thrown.

Configuration example

1{
2  "name": "FLUENTRETAIL.globalinventory.CreateCategory"
3}

Detailed Technical Description

All the event attributes of the incoming event are parsed/deserialized into a "Category" object which has the following structure:
1public class Category {
2
3     @NonNull
4     private String ref;
5
6     private String type;
7
8     private List<Attribute> attributes;
9
10     private String name;
11
12     private String summary;
13
14     private String parentCategory;
15}
An example JSON payload that represents the event attributes of an incoming event:
1{
2  "ref": "INFT_1",
3  "type": "DEFAULT",
4  "attributes": [],
5  "name": "Infants Toys",
6  "summary": "summary",
7  "parentCategory": "parent_category_ref"
8}

This rule parses/deserializes all the event attributes into a Category object outlined above. It then creates a "category mutation" request using all the event attribute values. The `{entityRef}` value of the incoming event is used as the product catalogue reference of the category being created.

Version History

2023-07-28

v2.0.0

refers to plugin