Create a Custom Ruleset for Batch Inventory Input for Custom Quantity Types
Author:
Girish Padmanabha
Changed on:
18 Feb 2025
Key Points
- Preprocessing Disabled (Skip Enabled): If preprocessing is disabled (set to skip), all event items are passed as is, regardless of changes.
- Preprocessing Enabled: If preprocessing is enabled, only changed items are passed through as events.
- Event Structure: The batch input includes optional fields, and default values are set if they are not provided.
- Event Name: If you specify a custom event name in the batch input, it will be used in the resulting event. If not, the default event name is
`"InventoryChanged"`.
Steps
Steps to Create a Custom Ruleset for Batch Inventory Input for Custom Quantity Types
Step 1 : Prepare Your Batch Inventory Input Payload
- Structure your batch inventory input according to the format provided below.
- Include the
`event`field with your custom event name if desired.
`
`Notes:- Optional Fields and Defaults:
`event`: If not provided, defaults to`"InventoryChanged"`.`catalogueRef`: If not provided, defaults to`"DEFAULT:<retailerId>"`.`ref`,`type`, and`status`: Optional and passed through if provided.
- Attributes: Optional . Use the
`attributes`object within each entity to pass extra data, which will be included in the resulting event.
Step 2: Understand How the Batch Input Translates to Events
Preprocessing Behavior:
- Preprocessing Disabled (Skip Enabled): All entities are passed through as events, regardless of changes.
- Preprocessing Enabled: Only entities that are deemed changed are passed through as events.
Step 3: Create a Custom Ruleset
`inventoryQuantity.attributes`.The custom ruleset should be configured as the entry point for processing the batch events. Ensure that your ruleset logic:- Is present in the Inventory Catalog workflow of the right type
- Processes the
`inventoryQuantity.attributes`to handle custom quantity types. - Applies any business logic required for your specific use case.
Here is an example that mimics the InventoryChanged ruleset and has similar rules as the entry point from the Batch payload
Step 4: Configure the Batch Job Settings
- Disable Preprocessing (Skip Enabled): If you want all entities to be passed through as events, regardless of changes, set preprocessing to skip.
- Enable Preprocessing: If you want only changed entities to be passed through, keep preprocessing enabled.
- Set the Preprocessing Option in your batch job settings according to your needs.