Next-generation platform

Count events

Count events are generated as part of the Count APIs whenever a count task is created, assigned, or completed, and a count request is created or completed and a variance is approved in the Store Inventory Management microservice.

The following examples illustrate the count events in Sterling Store Engagement.

Count Request Created event

The Count Request Created event is applicable for cycle count, physical count, and manual count. When you create count requests in Store Inventory Management, Sterling Store Engagement triggers the Count Request Created event. The code for this event is countRequestCreated.

The following sample JSON illustrates the published event. The application encodes and adds the event data to messages[].data JSON path.

{
  "messages": [
    {
      "data": {
        "countRequestId": "23dd9d76-e059-4d95-910d-d517f1437d9e",
        "storeId": "S1",
        "type": "CYCLE",
        "status": "NOT_STARTED",
        "startDate": "2019-05-07T00:00:00Z",
        "expectedCompletionTime": "2019-05-18T23:59:59Z",
        "countProgramId": "20951fbe-bced-40a9-b6d6-5a87b7f19249",
        "exclusionDaysWeek": [
          "SUN"
        ],
        "varianceThreshold": 0,
        "requestedItems": [
          {
            "productId": "P1",
            "unitOfMeasure": "EACH"
          }
        ],
        "locationIds": [
          "L1"
        ],
        "itemLocations": [],
        "recounting": "RECOUNT_ON_VARIANCE",
        "serialScanning": "MANDATORY_RECOUNT",
        "countingType": "ITEM_LOCATION",
        "createdByUserId": "System",
        "performedByUserId": "System",
        "createdTimestamp": "2019-05-07T10:28:51.698Z"
      },
      "attributes": {
        "eventCode": "countRequestCreated",
        "timestamp": "2019-05-07T02:00:00+00:00",
        "messageId": "3cacb233-de1b-47f9-97a6-4486488f3201"
      }
    }
  ]
}

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

{
  "title": "Count Request Created event message",
  "type": "object",
  "description": "Indicates the message payload published for Count Request Created event.",
  "properties": {
    "messages": {
      "type": "array",
      "items": {
        "type": "object",
        "description": "Indicates the event data published in the message.",
        "properties": {
          "data": {
            "type": "object",
            "description": "Count request details.",
            "properties": {
              "countRequestId": {
                "type": "string",
                "format": "uuid",
                "description": "The count request identifier."
              },
              "storeId": {
                "type": "string",
                "description": "The store identifier."
              },
              "type": {
                "type": "string",
                "description": "Indicates the type of count request."
              },
              "status": {
                "type": "string",
                "description": "Indicates the count request status."
              },
              "startDate": {
                "type": "string",
                "format": "date-time",
                "description": "Indicates the start date of the count request."
              },
              "expectedCompletionTime": {
                "type": "string",
                "format": "date-time",
                "description": "Indicates the expected completion time of the count request."
              },
              "countProgramId": {
                "type": "string",
                "format": "uuid",
                "description": "The count program identifier."
              },
              "exclusionDaysWeek": {
                "type": "array",
                "description": "Indicates the days on which count task is not created.",
                "items": {
                  "type": "string"
                }
              },
              "varianceThreshold": {
                "type": "integer",
                "description": " Variance percentage, which recounting will be done."
              },
              "recounting": {
                "type": "string",
                "description": "Possible value is RECOUNT_ON_VARIANCE'"
              },
              "serialScanning": {
                "type": "string",
                "description": "Possible value is MANDATORY_RECOUNT"
              },
              "countingType": {
                "type": "string",
                "description": "Indicates the couting type. Possible value is ITEM_LOCATION."
              },
              "createdByUserId": {
                "type": "string",
                "description": "The user who created the count request."
              },
              "performedByUserId": {
                "type": "string",
                "description": "The user who performs the create count request operation."
              },
              "createdTimestamp": {
                "type": "string",
                "format": "date-time",
                "description": "Indicates the time when the count request was created."
              },
              "locationIds": {
                "type": "array",
                "description": "Indicates the list of location identifiers.",
                "items": {
                  "type": "string"
                }
              },
              "requestedItems": {
                "type": "array",
                "description": "List of requested items.",
                "items": {
                  "type": "object",
                  "properties": {
                    "productId": {
                      "type": "string",
                      "description": "The product identifier."
                    },
                    "unitOfMeasure": {
                      "type": "string",
                      "description": "Indicates the unit of measure for the product."
                    }
                  }
                }
              },
              "itemLocations": {
                "type": "array",
                "description": "List of item locations.",
                "items": {
                  "type": "object",
                  "properties": {
                    "requestedItem": {
                      "type": "object",
                      "description": "Requested item details.",
                      "properties": {
                        "productId": {
                          "type": "string",
                          "description": "The product identifier."
                        },
                        "unitOfMeasure": {
                          "type": "string",
                          "description": "Indicates the unit of measure for the product."
                        }
                      }
                    },
                    "locationIds": {
                      "type": "array",
                      "description": "Indicates the list of location identifiers.",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "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."
              }
            }
          }
        }
      }
    }
  }
}

Count Task Created event

The Count Task Created event is applicable for cycle count, physical count, and manual count. When you create count tasks in Store Inventory Management, Sterling Store Engagement triggers the Count Tasks Created event. The code for this event is countTasksCreated.

The following sample JSON illustrates the published event. Sterling Store Engagement encodes and adds the event data to messages[].data JSON path.

{
  "messages": [
    {
      "data": {
        "countRequestId": "23dd9d76-e059-4d95-910d-d517f1437d9e",
        "status": "NOT_STARTED",
        "performedByUsedId": "System",
        "countTasks": [
          {
            "countTaskId": "2220d7a2-8669-41a6-a27e-a86874c982ba",
            "type": "CYCLE",
            "locationId": "L1",
            "productId": "P1",
            "unitOfMeasure": "EACH",
            "expectedCompletionTime": "2019-05-07T23:59:59Z",
            "serialScanningRequired": false,
            "createdByUserId": "System",
            "createdTimestamp": "2019-05-07T10:28:51.701Z"
          }
        ]
      },
      "attributes": {
        "eventCode": "countTasksCreated",
        "timestamp": "2019-05-07T02:00:00+00:00",
        "messageId": "3cacb233-de1b-47f9-97a6-4486488f3201"
      }
    }
  ]
}

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

{
  "title": "Count Task Created event message",
  "type": "object",
  "description": "Indicates the message payload published for Count Task Created event.",
  "properties": {
    "messages": {
      "type": "array",
      "items": {
        "type": "object",
        "description": "Indicates the event data published in the message.",
        "properties": {
          "data": {
            "type": "object",
            "description": "Count request details.",
            "properties": {
              "countRequestId": {
                "type": "string",
                "format": "uuid",
                "description": "The count request identifier."
              },
              "status": {
                "type": "string",
                "description": "The status of count request,"
              },
              "performedByUserId": {
                "type": "string",
                "description": "User Id who performed the create count task operation"
              },
              "countTasks": {
                "type": "array",
                "description": "List of count tasks.",
                "items": {
                  "type": "object",
                  "description": "Count task details",
                  "properties": {
                    "countTaskId": {
                      "type": "string",
                      "format": "uuid",
                      "description": "The count task identifier."
                    },
                    "type": {
                      "type": "string",
                      "description": "The type of the count request."
                    },
                    "locationId": {
                      "type": "string",
                      "description": "The location identifier."
                    },
                    "productId": {
                      "type": "string",
                      "description": "The product identifier."
                    },
                    "unitOfMeasure": {
                      "type": "string",
                      "description": "Indicates the unit of measure for the product."
                    },
                    "expectedCompletionTime": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Indicates the expected completion time of the count task."
                    },
                    "serialScanningRequired": {
                      "type": "boolean",
                      "description": "Indicates whether serial scanning is required during count."
                    },
                    "createdByUserId": {
                      "type": "string",
                      "description": "The user who created the count request."
                    },
                    "createdTimestamp": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Indicates the time when the count task was created."
                    }
                  }
                }
              }
            }
          },
          "attributes": {
            "type": "object",
            "description": "Event details.",
            "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."
              }
            }
          }
        }
      }
    }
  }
}

Count Request Completed event

The Count Request Completed event is applicable for cycle count, physical count, and manual count. When you complete count requests in Store Inventory Management, Sterling Store Engagement triggers the Count Request Completed event. The code for this event is countRequestCompleted.

The following sample JSON illustrates the published event. Sterling Store Engagement encodes and adds the event data to messages[].data JSON path.

{
  "messages": [
    {
      "data": {
        "countRequestId": "23dd9d76-e059-4d95-910d-d517f1437d9e",
        "status": "COMPLETED",
        "performedByUserId": "System",
        "countTasks": [
          {
            "countTaskId": "2220d7a2-8669-41a6-a27e-a86874c982ba",
            "locationId": "L1",
            "productId": "P1",
            "unitOfMeasure": "EACH",
            "status": "COMPLETED_WITH_VARIANCE",
            "originalTaskId": "",
            "hasDiscrepancy": true,
            "actualExecutionDate": "2019-05-07T13:59:59Z",
            "serialScanningRequired": false,
            "recordedAttributes": [
              {
                "productClass": "NEW",
                "inventoryStatus": "GOOD",
                "segment": "PURPOSE",
                "segmentType": "VENDOR_FULFILLMENT",
                "tagNo": "Tag01",
                "batchNo": "Batch01",
                "lotNo": "Lot01",
                "manufacturedDate": "2019-05-07T09:12:31.465Z",
                "count": 7,
                "serials": []
              }
            ],
            "varianceAttributes": [
              {
                "productClass": "NEW",
                "inventoryStatus": "GOOD",
                "segment": "PURPOSE",
                "segmentType": "VENDOR_FULFILLMENT",
                "tagNo": "Tag01",
                "batchNo": "Batch01",
                "lotNo": "Lot01",
                "manufacturedDate": "2019-05-07T09:12:31.465Z",
                "variance": -3,
                "newSerialsFound": [],
                "serialsMissing": []
              }
            ]
          }
        ]
      },
      "attributes": {
        "eventCode": "countRequestCompleted",
        "timestamp": "2019-05-07T02:00:00+00:00",
        "messageId": "3cacb233-de1b-47f9-97a6-4486488f3201"
      }
    }
  ]
}

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

{
  "title": "Count Request Completed event message",
  "type": "object",
  "description": "Indicates the message payload published for Count Request Completed event.",
  "properties": {
    "messages": {
      "type": "array",
      "items": {
        "type": "object",
        "description": "Indicates the event data published in the message.",
        "properties": {
          "data": {
            "type": "object",
            "description": "Count request details",
            "properties": {
              "countRequestId": {
                "type": "string",
                "format": "uuid",
                "description": "The count request identifier."
              },
              "status": {
                "type": "string",
                "description": "The status of count request."
              },
              "performedByUserId": {
                "type": "string",
                "description": "User Id who has performed the complete count request operation."
              },
              "countTasks": {
                "type": "array",
                "description": "List of count tasks",
                "items": {
                  "type": "object",
                  "description": "Count task details.",
                  "properties": {
                    "countTaskId": {
                      "type": "string",
                      "format": "uuid",
                      "description": "The count task identifier."
                    },
                    "locationId": {
                      "type": "string",
                      "description": "The location identifier."
                    },
                    "productId": {
                      "type": "string",
                      "description": "The product identifier."
                    },
                    "unitOfMeasure": {
                      "type": "string",
                      "description": "The unit of measure for the product."
                    },
                    "status": {
                      "type": "string",
                      "description": "Indicates the status of count task."
                    },
                    "originalTaskId": {
                      "type": "string",
                      "format": "uuid",
                      "description": "Indicates the original count task identifier."
                    },
                    "hasDiscrepancy": {
                      "type": "boolean",
                      "description": "Indicates whether any discrepancy was found during count execution."
                    },
                    "actualExecutionDate": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Indicates the execution time of the count task."
                    },
                    "serialScanningRequired": {
                      "type": "boolean",
                      "description": "Indicates whether serial number scan is required."
                    },
                    "recordedAttributes": {
                      "type": "array",
                      "description": "",
                      "items": {
                        "type": "object",
                        "description": "Indicates the event data published in the message.",
                        "properties": {
                          "productClass": {
                            "type": "string",
                            "description": "Indicates the product class."
                          },
                          "inventoryStatus": {
                            "type": "string",
                            "description": "Indicates the inventory status of the product."
                          },
                          "segment": {
                            "type": "string",
                            "description": "Indicates the segment of the product."
                          },
                          "segmentType": {
                            "type": "string",
                            "description": "Indicates the segment type of the product."
                          },
                          "tagNo": {
                            "type": "string",
                            "description": "Indicates the tag number of the product."
                          },
                          "batchNo": {
                            "type": "string",
                            "description": "Indicates the batch number of the product."
                          },
                          "lotNo": {
                            "type": "string",
                            "description": "Indicates the lot number of the product."
                          },
                          "manufacturedDate": {
                            "type": "string",
                            "format": "date-time",
                            "description": "Indicates the manufacturing date of the product. Date format - yyyy-MM-ddTHH:mm:ss.SSSZ"
                          },
                          "count": {
                            "type": "integer",
                            "description": ""
                          },
                          "serials": {
                            "type": "array",
                            "description": "List of serial numbers. ",
                            "items": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    },
                    "varianceAttributes": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "productClass": {
                            "type": "string",
                            "description": "Indicates the product class."
                          },
                          "inventoryStatus": {
                            "type": "string",
                            "description": "Indicates the inventory status of the product."
                          },
                          "segment": {
                            "type": "string",
                            "description": "Indicates the segment of the product."
                          },
                          "segmentType": {
                            "type": "string",
                            "description": "Indicates the segment type of the product."
                          },
                          "tagNo": {
                            "type": "string",
                            "description": "Indicates the tag number of the product."
                          },
                          "batchNo": {
                            "type": "string",
                            "description": "Indicates the batch number of the product."
                          },
                          "lotNo": {
                            "type": "string",
                            "description": "Indicates the lot number of the product."
                          },
                          "manufacturedDate": {
                            "type": "string",
                            "format": "date-time",
                            "description": "Indicates the manufacturing date of the product. Date format - yyyy-MM-ddTHH:mm:ss.SSSZ"
                          },
                          "variance": {
                            "type": "integer",
                            "description": "."
                          },
                          "newSerialsFound": {
                            "type": "array",
                            "description": "List of new serial numbers found during count execution.",
                            "items": {
                              "type": "string"
                            }
                          },
                          "serialsMissing": {
                            "type": "array",
                            "description": "List of serial numbers missing during count execution.",
                            "items": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "attributes": {
            "type": "object",
            "description": "Event details",
            "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."
              }
            }
          }
        }
      }
    }
  }
}

Count Task Assigned event

The Count Task Assigned event is applicable for cycle count, physical count, and manual count. When you assign count tasks in Store Inventory Management, Sterling Store Engagement triggers the Count Task Assigned event. The code for this event is countTasksAssigned.

The following sample JSON illustrates the published event. Sterling Store Engagement encodes and adds the event data to messages[].data JSON path.

{
  "messages": [
    {
      "data": {
        "assignedToUserId": "Jim",
        "performedByUserId": "John",
        "countTasks": [
          {
            "countTaskId": "2220d7a2-8669-41a6-a27e-a86874c982ba",
            "countRequestId": "23dd9d76-e059-4d95-910d-d517f1437d9e",
            "originalTaskId": "",
            "locationId": "L1",
            "productId": "P1",
            "unitOfMeasure": "EACH"
          }
        ]
      },
      "attributes": {
        "eventCode": "countTasksAssigned",
        "timestamp": "2019-05-07T02:00:00+00:00",
        "messageId": "3cacb233-de1b-47f9-97a6-4486488f3201"
      }
    }
  ]
}

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

{
  "title": "Count Task Assigned event message",
  "type": "object",
  "description": "Indicates the message payload published for Count Task Assigned event.",
  "properties": {
    "messages": {
      "type": "array",
      "items": {
        "type": "object",
        "description": "Indicates the event data published in the message.",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "assignedToUserId": {
                "type": "string",
                "description": "User to whom the tasks are to be assigned."
              },
              "performedByUserId": {
                "type": "string",
                "decription": "User Id who has performed assign to user Id operation"
              },
              "countTasks": {
                "type": "array",
                "description": "List of count tasks.",
                "items": {
                  "type": "object",
                  "description": "Count task details.",
                  "properties": {
                    "countTaskId": {
                      "type": "string",
                      "format": "uuid",
                      "description": "The count task identifier."
                    },
                    "countRequestId": {
                      "type": "string",
                      "format": "uuid",
                      "description": "The count request identifier."
                    },
                    "originalTaskId": {
                      "type": "string",
                      "format": "uuid",
                      "description": ""
                    },
                    "locationId": {
                      "type": "string",
                      "description": "The location identifier"
                    },
                    "productId": {
                      "type": "string",
                      "description": "The product identifier."
                    },
                    "unitOfMeasure": {
                      "type": "string",
                      "description": "Indicates the unit of measure for the product."
                    }
                  }
                }
              }
            }
          },
          "attributes": {
            "type": "object",
            "description": "Event details.",
            "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."
              }
            }
          }
        }
      }
    }
  }
}

Variance Approved event

When you approve variance in Store Inventory Management, Sterling Store Engagement triggers the Variance Approved event. The code for this event is varianceApproved.

The following sample JSON illustrates the published event for cycle count, manual count, and physical count when variance calculation is set at the task level. Sterling Store Engagement encodes and adds the event data to messages[].data JSON path.

{
  "messages": [
    {
      "data": {
        "countTaskId": "2220d7a2-8669-41a6-a27e-a86874c982bb",
        "locationId": "L1",
        "productId": "P1",
        "unitOfMeasure": "EACH",
        "status": "COMPLETED",
        "performedByUserId": "Jim",
        "countRequestId": "23dd9d76-e059-4d95-910d-d517f1437d9e",
        "originalTaskId": "2220d7a2-8669-41a6-a27e-a86874c982ba",
        "hasDiscrepancy": true,
        "actualExecutionDate": "2019-05-07T13:59:59Z",
        "serialScanningRequired": false,
        "varianceStatus": "APPROVED",
        "varianceReason": "Extra_Items_Found",
        "varianceAttributes": [
          {
            "productClass": "NEW",
            "inventoryStatus": "GOOD",
            "segment": "PURPOSE",
            "segmentType": "VENDOR_FULFILLMENT",
            "tagNo": "Tag01",
            "batchNo": "Batch01",
            "lotNo": "Lot01",
            "manufacturedDate": "2019-05-07T09:12:31.465Z",
            "variance": 2,
            "newSerialsFound": [
              "Serial1"
            ],
            "serialsMissing": []
          }
        ]
      },
      "attributes": {
        "eventCode": "varianceApproved",
        "timestamp": "2019-05-07T02:00:00+00:00",
        "messageId": "3cacb233-de1b-47f9-97a6-4486488f3201"
      }
    }
  ]
}

The following sample illustrates the JSON schema specification for cycle count, manual count, and physical count when variance calculation is set at the task level, which defines the structure of JSON data published to the varianceApproved event.

{
  "title": "Variance Approved event message",
  "type": "object",
  "description": "Indicates the message payload published for Variance Approved event.",
  "properties": {
    "messages": {
      "type": "array",
      "items": {
        "type": "object",
        "description": "Indicates the event data published in the message.",
        "properties": {
          "data": {
            "type": "object",
            "description": "Count task details.",
            "properties": {
              "countTaskId": {
                "type": "string",
                "format": "uuid",
                "description": "The count task identifier."
              },
              "locationId": {
                "type": "string",
                "description": "The location identifier."
              },
              "productId": {
                "type": "string",
                "description": "The product identifier."
              },
              "unitOfMeasure": {
                "type": "string",
                "description": "Indicates the unit of measure for the product."
              },
              "status": {
                "type": "string",
                "description": "Status of the count task."
              },
              "performedByUserId": {
                "type": "string",
                "description": "User Id who has performed approve-variance operation."
              },
              "countRequestId": {
                "type": "string",
                "format": "uuid",
                "description": "The count request identifier."
              },
              "originalTaskId": {
                "type": "string",
                "format": "uuid",
                "description": "The count task identifier."
              },
              "hasDiscrepancy": {
                "type": "boolean",
                "description": "Indicates whether any discrepancy was found during count execution."
              },
              "actualExecutionDate": {
                "type": "string",
                "format": "date-time",
                "description": "Indicates the execution time of the count task."
              },
              "serialScanningRequired": {
                "type": "boolean",
                "description": "Indicates whether serial scanning is required during count."
              },
              "varianceStatus": {
                "type": "string",
                "description": ""
              },
              "varianceReason": {
                "type": "string",
                "description": ""
              },
              "varianceAttributes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "description": "Variance attribute details.",
                  "properties": {
                    "productClass": {
                      "type": "string",
                      "description": "Indicates the class of product."
                    },
                    "inventoryStatus": {
                      "type": "string",
                      "description": "Indicates the status of inventory for the product."
                    },
                    "segment": {
                      "type": "string",
                      "description": "Indicates the segment of the product."
                    },
                    "segmentType": {
                      "type": "string",
                      "description": "Indicates the segment type of the product."
                    },
                    "tagNo": {
                      "type": "string",
                      "description": "Indicates the tag number of the product."
                    },
                    "batchNo": {
                      "type": "string",
                      "description": "Indicates the batch number of the product."
                    },
                    "lotNo": {
                      "type": "string",
                      "description": "Indicates the lot number of the product."
                    },
                    "manufacturedDate": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Indicates the manufacturing date of the product. Date format - yyyy-MM-ddTHH:mm:ss.SSSZ"
                    },
                    "variance": {
                      "type": "integer",
                      "description": ""
                    },
                    "newSerialsFound": {
                      "type": "array",
                      "description": "List of new serial numbers found during count execution.",
                      "items": {
                        "type": "string"
                      }
                    },
                    "serialsMissing": {
                      "type": "array",
                      "description": "List of serial numbers found missing during count execution.",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "attributes": {
            "type": "object",
            "description": "Event details.",
            "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."
              }
            }
          }
        }
      }
    }
  }
}

The following sample JSON illustrates the published event for physical count when variance calculation is set at the product level. Sterling Store Engagement encodes and adds the event data to messages[].data JSON path.

{
  "messages": [
    {
      "data": {
        "locationId": "L1",
        "productId": "P1",
        "unitOfMeasure": "EACH",
        "status": "COMPLETED",
        "performedByUserId": "John",
        "countRequestId": "23dd9d76-e059-4d95-910d-d517f1437d9e",
        "hasDiscrepancy": true,
        "varianceStatus": "APPROVED",
        "varianceReason": "Extra_Items_Found",
        "varianceAttributes": [
          {
            "productClass": "NEW",
            "inventoryStatus": "GOOD",
            "segment": "PURPOSE",
            "segmentType": "VENDOR_FULFILLMENT",
            "tagNo": "Tag01",
            "batchNo": "Batch01",
            "lotNo": "Lot01",
            "manufacturedDate": "2019-05-07T09:12:31.465Z",
            "variance": 2,
            "newSerialsFound": [
              "Serial1"
            ],
            "serialsMissing": []
          }
        ]
      },
      "attributes": {
        "eventCode": "varianceApproved",
        "timestamp": "2019-05-07T02:00:00+00:00",
        "messageId": "3cacb233-de1b-47f9-97a6-4486488f3201"
      }
    }
  ]
}

The following sample illustrates the JSON schema specification for physical count when variance calculation is set at the product level, which defines the structure of JSON data published to the varianceApproved event.

{
  "title": "Variance Approved event message",
  "type": "object",
  "description": "Indicates the message payload published for Variance Approved event.",
  "properties": {
    "messages": {
      "type": "array",
      "items": {
        "type": "object",
        "description": "Indicates the event data published in the message.",
        "properties": {
          "data": {
            "type": "object",
            "description": "Count task details.",
            "properties": {
              "locationId": {
                "type": "string",
                "description": "The location identifier."
              },
              "productId": {
                "type": "string",
                "description": "The product identifier."
              },
              "unitOfMeasure": {
                "type": "string",
                "description": "Indicates the unit of measure for the product."
              },
              "status": {
                "type": "string",
                "description": "Status of the count task."
              },
              "performedByUserId": {
                "type": "string",
                "description": "User Id who has performed approve-variance operation."
              },
              "countRequestId": {
                "type": "string",
                "format": "uuid",
                "description": "The count request identifier."
              },
              "hasDiscrepancy": {
                "type": "boolean",
                "description": "Indicates whether any discrepancy was found during count execution."
              },
              "varianceStatus": {
                "type": "string",
                "description": ""
              },
              "varianceReason": {
                "type": "string",
                "description": ""
              },
              "varianceAttributes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "description": "Variance attribute details.",
                  "properties": {
                    "productClass": {
                      "type": "string",
                      "description": "Indicates the class of product."
                    },
                    "inventoryStatus": {
                      "type": "string",
                      "description": "Indicates the status of inventory for the product."
                    },
                    "segment": {
                      "type": "string",
                      "description": "Indicates the segment of the product."
                    },
                    "segmentType": {
                      "type": "string",
                      "description": "Indicates the segment type of the product."
                    },
                    "tagNo": {
                      "type": "string",
                      "description": "Indicates the tag number of the product."
                    },
                    "batchNo": {
                      "type": "string",
                      "description": "Indicates the batch number of the product."
                    },
                    "lotNo": {
                      "type": "string",
                      "description": "Indicates the lot number of the product."
                    },
                    "manufacturedDate": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Indicates the manufacturing date of the product. Date format - yyyy-MM-ddTHH:mm:ss.SSSZ"
                    },
                    "variance": {
                      "type": "integer",
                      "description": ""
                    },
                    "newSerialsFound": {
                      "type": "array",
                      "description": "List of new serial numbers found during count execution.",
                      "items": {
                        "type": "string"
                      }
                    },
                    "serialsMissing": {
                      "type": "array",
                      "description": "List of serial numbers found missing during count execution.",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "attributes": {
            "type": "object",
            "description": "Event details.",
            "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."
              }
            }
          }
        }
      }
    }
  }
}

Variance Rejected event

When you approve variance in Store Inventory Management, Sterling Store Engagement triggers the Variance Rejected event. The code for this event is varianceRejected.

The following sample JSON illustrates the published event for cycle count, manual count, and physical count when variance calculation is set at the task level. Sterling Store Engagement encodes and adds the event data to messages[].data JSON path.

{
  "messages": [
    {
      "data": {
        "countTaskId": "2220d7a2-8669-41a6-a27e-a86874c982bb",
        "locationId": "L1",
        "productId": "P1",
        "unitOfMeasure": "EACH",
        "status": "COMPLETED",
        "performedByUserId": "John",
        "countRequestId": "23dd9d76-e059-4d95-910d-d517f1437d9e",
        "originalTaskId": "2220d7a2-8669-41a6-a27e-a86874c982ba",
        "hasDiscrepancy": true,
        "actualExecutionDate": "2019-05-07T13:59:59Z",
        "serialScanningRequired": false,
        "varianceStatus": "REJECTED",
        "varianceReason": "Extra_Items_Found",
        "varianceAttributes": [
          {
            "productClass": "NEW",
            "inventoryStatus": "GOOD",
            "segment": "PURPOSE",
            "segmentType": "VENDOR_FULFILLMENT",
            "tagNo": "Tag01",
            "batchNo": "Batch01",
            "lotNo": "Lot01",
            "manufacturedDate": "2019-05-07T09:12:31.465Z",
            "variance": 2,
            "newSerialsFound": [
              "Serial1"
            ],
            "serialsMissing": []
          }
        ]
      },
      "attributes": {
        "eventCode": "varianceRejected",
        "timestamp": "2019-05-07T02:00:00+00:00",
        "messageId": "3cacb233-de1b-47f9-97a6-4486488f3201"
      }
    }
  ]
}

The following sample illustrates the JSON schema specification for cycle count, manual count, and physical count when variance calculation is set at the task level, which defines the structure of JSON data published to the varianceRejected event.

{
  "title": "Variance Rejected event message",
  "type": "object",
  "description": "Indicates the message payload published for Variance Rejected event.",
  "properties": {
    "messages": {
      "type": "array",
      "items": {
        "type": "object",
        "description": "Indicates the event data published in the message.",
        "properties": {
          "data": {
            "type": "object",
            "description": "Count task details.",
            "properties": {
              "countTaskId": {
                "type": "string",
                "format": "uuid",
                "description": "The count task identifier."
              },
              "locationId": {
                "type": "string",
                "description": "The location identifier."
              },
              "productId": {
                "type": "string",
                "description": "The product identifier."
              },
              "unitOfMeasure": {
                "type": "string",
                "description": "Indicates the unit of measure for the product."
              },
              "status": {
                "type": "string",
                "description": "Status of the count task."
              },
              "performedByUserId": {
                "type": "string",
                "description": "User Id who has performed reject-variance operation."
              },
              "countRequestId": {
                "type": "string",
                "format": "uuid",
                "description": "The count request identifier."
              },
              "originalTaskId": {
                "type": "string",
                "format": "uuid",
                "description": "The count task identifier."
              },
              "hasDiscrepancy": {
                "type": "boolean",
                "description": "Indicates whether any discrepancy was found during count execution."
              },
              "actualExecutionDate": {
                "type": "string",
                "format": "date-time",
                "description": "Indicates the execution time of the count task."
              },
              "varianceStatus": {
                "type": "string",
                "description": ""
              },
              "varianceReason": {
                "type": "string",
                "description": ""
              },
              "varianceAttributes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "description": "Variance attribute details.",
                  "properties": {
                    "productClass": {
                      "type": "string",
                      "description": "Indicates the class of product."
                    },
                    "inventoryStatus": {
                      "type": "string",
                      "description": "Indicates the status of inventory for the product."
                    },
                    "segment": {
                      "type": "string",
                      "description": "Indicates the segment of the product."
                    },
                    "segmentType": {
                      "type": "string",
                      "description": "Indicates the segment type of the product."
                    },
                    "tagNo": {
                      "type": "string",
                      "description": "Indicates the tag number of the product."
                    },
                    "batchNo": {
                      "type": "string",
                      "description": "Indicates the batch number of the product."
                    },
                    "lotNo": {
                      "type": "string",
                      "description": "Indicates the lot number of the product."
                    },
                    "manufacturedDate": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Indicates the manufacturing date of the product. Date format - yyyy-MM-ddTHH:mm:ss.SSSZ"
                    },
                    "variance": {
                      "type": "integer",
                      "description": ""
                    },
                    "newSerialsFound": {
                      "type": "array",
                      "description": "List of new serial numbers found during count execution.",
                      "items": {
                        "type": "string"
                      }
                    },
                    "serialsMissing": {
                      "type": "array",
                      "description": "List of serial numbers found missing during count execution.",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "attributes": {
            "type": "object",
            "description": "Event details.",
            "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."
              }
            }
          }
        }
      }
    }
  }
}

The following sample JSON illustrates the published event for physical count when variance calculation is set at the product level. Sterling Store Engagement encodes and adds the event data to messages[].data JSON path.

{
  "messages": [
    {
      "data": {
        "locationId": "L1",
        "productId": "P1",
        "unitOfMeasure": "EACH",
        "status": "COMPLETED",
        "performedByUserId": "John",
        "countRequestId": "23dd9d76-e059-4d95-910d-d517f1437d9e",
        "hasDiscrepancy": true,
        "varianceStatus": "REJECTED",
        "varianceReason": "Extra_Items_Found",
        "varianceAttributes": [
          {
            "productClass": "NEW",
            "inventoryStatus": "GOOD",
            "segment": "PURPOSE",
            "segmentType": "VENDOR_FULFILLMENT",
            "tagNo": "Tag01",
            "batchNo": "Batch01",
            "lotNo": "Lot01",
            "manufacturedDate": "2019-05-07T09:12:31.465Z",
            "variance": 2,
            "newSerialsFound": [
              "Serial1"
            ],
            "serialsMissing": []
          }
        ]
      },
      "attributes": {
        "eventCode": "varianceRejected",
        "timestamp": "2019-05-07T02:00:00+00:00",
        "messageId": "3cacb233-de1b-47f9-97a6-4486488f3201"
      }
    }
  ]
}

The following sample illustrates the JSON schema specification for physical count when variance calculation is set at the product level, which defines the structure of JSON data published to the varianceRejected event.

{
  "title": "Variance Rejected event message",
  "type": "object",
  "description": "Indicates the message payload published for Variance Rejected event.",
  "properties": {
    "messages": {
      "type": "array",
      "items": {
        "type": "object",
        "description": "Indicates the event data published in the message.",
        "properties": {
          "data": {
            "type": "object",
            "description": "Count task details.",
            "properties": {
              "locationId": {
                "type": "string",
                "description": "The location identifier."
              },
              "productId": {
                "type": "string",
                "description": "The product identifier."
              },
              "unitOfMeasure": {
                "type": "string",
                "description": "Indicates the unit of measure for the product."
              },
              "status": {
                "type": "string",
                "description": "Status of the count task."
              },
              "performedByUserId": {
                "type": "string",
                "description": "User Id who has performed reject-variance operation."
              },
              "countRequestId": {
                "type": "string",
                "format": "uuid",
                "description": "The count request identifier."
              },
              "hasDiscrepancy": {
                "type": "boolean",
                "description": "Indicates whether any discrepancy was found during count execution."
              },
              "varianceStatus": {
                "type": "string",
                "description": ""
              },
              "varianceReason": {
                "type": "string",
                "description": ""
              },
              "varianceAttributes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "description": "Variance attribute details.",
                  "properties": {
                    "productClass": {
                      "type": "string",
                      "description": "Indicates the class of product."
                    },
                    "inventoryStatus": {
                      "type": "string",
                      "description": "Indicates the status of inventory for the product."
                    },
                    "segment": {
                      "type": "string",
                      "description": "Indicates the segment of the product."
                    },
                    "segmentType": {
                      "type": "string",
                      "description": "Indicates the segment type of the product."
                    },
                    "tagNo": {
                      "type": "string",
                      "description": "Indicates the tag number of the product."
                    },
                    "batchNo": {
                      "type": "string",
                      "description": "Indicates the batch number of the product."
                    },
                    "lotNo": {
                      "type": "string",
                      "description": "Indicates the lot number of the product."
                    },
                    "manufacturedDate": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Indicates the manufacturing date of the product. Date format - yyyy-MM-ddTHH:mm:ss.SSSZ"
                    },
                    "variance": {
                      "type": "integer",
                      "description": ""
                    },
                    "newSerialsFound": {
                      "type": "array",
                      "description": "List of new serial numbers found during count execution.",
                      "items": {
                        "type": "string"
                      }
                    },
                    "serialsMissing": {
                      "type": "array",
                      "description": "List of serial numbers found missing during count execution.",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "attributes": {
            "type": "object",
            "description": "Event details.",
            "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."
              }
            }
          }
        }
      }
    }
  }
}