Next-generation platform

Inventory adjustment events

Inventory adjustment events are raised whenever inventory is adjusted in Store Inventory Management by direct API calls or as part of various flows such as receive or unreceive inventory, shipment confirmation in ship, customer pick up flows, confirmation of carry orders, and count variance acceptance.

Inventory Adjustment event

When you adjust inventory in Store Inventory Management, Sterling Store Engagement triggers the Inventory Adjustment event. The code for this event is inventoryAdjustment.

The following sample JSON illustrates the published event that is generated when containers are received as part of the receive inventory flow. The application encodes and adds the event data to messages[].data JSON path.

{
  "messages": [
    {
      "data": {
        "storeId": "BOSTON-1",
        "adjustmentType": "RECEIVING|SALE|COUNT|RECLASSIFICATION|RETURN",
        "adjustmentReason": "Inventory adjustement reason",
        "reservationReference": "de1b-47f9-97a6",
        "reservationId": "res-123",
        "orderNo": "Order-1001",
        "shipmentNo": "SH-0989",
        "performedByUserId": "John",
        "receiptNo": "",
        "references": {},
        "adjustments": [
          {
            "productId": "SMART-TABLET",
            "unitOfMeasure": "EACH",
            "productClass": "NEW",
            "inventoryStatus": "GOOD",
            "segmentType": "",
            "segment": "",
            "tagNo": "",
            "batchNo": "",
            "lotNo": "",
            "manufacturedDate": "",
            "serials": [],
            "adjustmentQuantity": 4,
            "quantity": 10,
            "locationId": "STORE-FRONT-1",
            "additionalAttributes": {
              "AdditionalProp1": "Value1",
              "AdditionalProp2": "Value2",
              "AdditionalProp3": "Value3"
            }
          }
        ]
      },
      "attributes": {
        "eventCode": "inventoryAdjustment",
        "timestamp": "2021-11-18T10:34:49.997304Z",
        "messageId": "7ce9bfaa-87c2-4957-8332-f0b9cf0f1c5a"
      }
    }
  ]
}

The following sample illustrates the JSON schema specification that defines the structure of JSON data published to the inventoryAdjustment event.

{
  "title": "Inventory Adjustment event message",
  "type": "object",
  "description": "Indicates the message payload published for Inventory Adjustment event.",
  "properties": {
    "messages": {
      "type": "array",
      "description": "",
      "items": {
        "type": "object",
        "description": "Indicates the event data published in the message.",
        "properties": {
          "data": {
            "type": "object",
            "description": "",
            "properties": {
              "storeId": {
                "type": "string",
                "description": "The store identifier"
              },
              "adjustmentType": {
                "type": "string",
                "description": "Indicates type of adjustment operation. Allowed value - RECEIVING, SALE, COUNT, RECLASSIFICATION or RETURN"
              },
              "adjustmentReason": {
                "type": "string",
                "description": "Inventory adjustment reason"
              },
              "reservationReference": {
                "type": "string",
                "description": "Reference to the reservations obtained for the inventory"
              },
              "reservationId": {
                "type": "string",
                "description": "The reservation Identifier"
              },
              "orderNo": {
                "type": "string",
                "description": "The order Identifier"
              },
              "shipmentNo": {
                "type": "string",
                "description": "The shipment Identifier"
              },
              "receiptNo": {
                "type": "string",
                "description": "The receipt Identifier"
              },
              "performedByUserId": {
                "type": "string",
                "description": "User Id who has performed the inventory adjustment."
              },
              "references": {
                "type": "object",
                "description": "Holds key-value pair of type string",
                "patternProperties": {
                  "^.*$": {
                    "type": "string"
                  }
                },
                "additionalProperties": {
                  "type": "string"
                }
              },
              "adjustments": {
                "type": "array",
                "description": "",
                "items": {
                  "type": "object",
                  "description": "",
                  "properties": {
                    "productId": {
                      "type": "string",
                      "description": "The product identifier"
                    },
                    "unitOfMeasure": {
                      "type": "string",
                      "description": "The unit of measure for the product"
                    },
                    "productClass": {
                      "type": "string",
                      "description": "The product class of the product"
                    },
                    "inventoryStatus": {
                      "type": "string",
                      "description": "Indicates the inventory status"
                    },
                    "segmentType": {
                      "type": "string",
                      "description": "Indicates the segment type"
                    },
                    "segment": {
                      "type": "string",
                      "description": "Indicates the segment"
                    },
                    "tagNo": {
                      "type": "string",
                      "description": "Indicates the tag number"
                    },
                    "batchNo": {
                      "type": "string",
                      "description": "Indicates the batch number"
                    },
                    "lotNo": {
                      "type": "string",
                      "description": "Indicates the lot number"
                    },
                    "manufacturedDate": {
                      "type": "string",
                      "description": "Indicates the manufacturing date of the product"
                    },
                    "serials": {
                      "type": "array",
                      "description": "Indicates list of serial numbers adjusted",
                      "items": {
                        "type": "string"
                      }
                    },
                    "adjustmentQuantity": {
                      "type": "number",
                      "format": "double",
                      "description": "The item quantity adjusted to the inventory"
                    },
                    "quantity": {
                      "type": "number",
                      "format": "double",
                      "description": "The total item quantity available at the location after adjusting the inventory"
                    },
                    "locationId": {
                      "type": "string",
                      "description": "The location identifier for the store"
                    },
                    "additionalAttributes": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "description": "Indicates attribute key"
                        },
                        "value": {
                          "type": "string",
                          "description": "Indicates attribute value"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "attributes": {
            "type": "object",
            "description": "",
            "properties": {
              "eventCode": {
                "type": "string",
                "description": "Indicates the event code of the message."
              },
              "timestamp": {
                "type": "string",
                "format": "date-time",
                "description": "Indicates the time when the message was triggered."
              },
              "messageId": {
                "type": "string",
                "format": "uuid",
                "description": "Indicates the message identifier."
              }
            }
          }
        }
      }
    }
  }
}
Note: In this event, you can automatically populate custom references by extending the yfs_shipment table. Extend the yfs_shipment table with column names starting with EXTN_SIM and XML name starting with ExtnSIM. For example, add a column with name EXTN_SIM_VENDOR and XML name as ExtnSIMVendor. The reference key in the event is updated as ExtnSIMVendor and the value is updated as the value of the column as shown.
"references": {
"ExtnSIMVendor": "vendor_id",
},