Supply audit due to segment allocation

Consider that segment allocation is enabled and an allocation plan is configured in the system. When a supply sync user request is made, the system allocates the supplies to applicable segments based on the allocation plan.

For more information on API details, see Reallocate items across segments API.

The supply audit records capture these changes made to the inventory supply by user as well as by the system.

Supply audit attributes

Purpose attribute
For supply audit records, there are different types of purposes that are applicable. The purpose attribute specifies the reason for the generated audit. The following purposes are available:
  • SUPPLY_SYNC - When the Supply sync API request is made.
  • SUPPLY_ADJUSTMENT - When the Supply adjust API request is made.
  • SEGMENT_ALLOCATION - When the Supply sync API request causes segment rebalancing.
  • SEGMENT_REALLOCATION - When an automated segment rebalancing occurs at a scheduled time interval or when segment reallocation is user initiated request. For more information, see the Reallocate items across segments API.
Parent Action Id
Every supply sync operation that causes the system to perform inventory allocation generates an action Id for the original user request. This action Id is set as the parent action Id. All the system updates due to this original supply update are then stamped with the same parent Action Id for traceability. Each audit record is also stamped with a unique action Id.
RelatedBy Action Id
When supply updates occur due to an automated segment reallocation or a user-triggered segment reallocation, the system generates an Id that is stamped as relatedByActionId on all related supply audit records as per the allocation plan for traceability. Each audit record is also stamped with a unique action Id.
Audit type
The audit record provides an audit type attribute that indicates who initiated the inventory update. Following are the two audit type values:
Audits by user
User-triggered audits are generated either by a supply sync or supply adjustment user request. Additionally, it is also generated due to a manual reallocation request using Reallocate items across segments API.
Audits by system
System-generated audits is triggered by an automated segment reallocation process executed at scheduled time intervals. For more information, see Segment rebalancing.
Audit details
Audit details contains more information about the operation that initiated the generation of additional audit records, that could be due to segment allocation or reallocation.

For example, in the case of segment allocation or reallocation, audit details contains the allocation plan used, such as the ruleId and rule's Action object containing segment-wise allocation quantity.

Querying for supply audit with system updates

To search for audit records based on who performed the inventory update, whether USER or SYSTEM, use the auditType attribute as an input filter. When auditType is not passed, it is defaulted to USER and only the top level USER initiated audit records are published. Both values of USER and SYSTEM may also be passed where all the audit records initiated by either USER or SYSTEM gets published.

To find all the system updates to supply for a given supply sync user request, parentActionId can be used in the input filter. Additionally, to find all the system updates due to segment reallocation, the relatedByActionId may be used.

Examples of supply audits

The following examples demonstrate how the supply audit works in user-triggered and system-triggered audits when segment allocation rule is enabled.
User-triggered audit
Suppose the supply is zero qty for ItemId = PLATE and according to the segment allocation plan, the supply distribution is 60% for the B2B segment and 40% for the B2C segment. Consider that the user requests a supply sync for PLATE with 100 quantity.
  • The allocation action for PLATE becomes +60 quantity to the B2B by system.
  • The allocation action for PLATE becomes +40 quantity to the B2C by system.
The user initiated audit record is populated with the following attributes:
  • actionId - 6a6c52da-0ad8-4d9e-859c-8a0df964a9be
  • parentActionId - 6a6c52da-0ad8-4d9e-859c-8a0df964a9be
  • auditType - USER
  • purpose - SUPPLY_SYNC
  • changedQuantity - 100
The system update for B2B audit record is populated with the following attributes:
  • actionId - 6a6c52da-0ad8-4d9e-859c-8a0df964a9be-0
  • parentActionId - 6a6c52da-0ad8-4d9e-859c-8a0df964a9be
  • auditType - USER
  • purpose - SEGMENT_ALLOCATION
  • changedQuantity - 60
  • segment - B2B
The system update for B2C segment shows audit data with following details:
  • actionId - 6a6c52da-0ad8-4d9e-859c-8a0df964a9be-1
  • parentActionId - 6a6c52da-0ad8-4d9e-859c-8a0df964a9be
  • auditType - USER
  • purpose - SEGMENT_ALLOCATION
  • changedQuantity - 40
  • segment - B2C
In addition to the above original user request, the audit data generated shows the changes that are carried out by the system in accordance with the applicable segment allocation plan. You can obtain these records by passing parentActionId=6a6c52da-0ad8-4d9e-859c-8a0df964a9be.
System-triggered audits
When segment reallocation causes inventory supply updates either due to an automated trigger or a user API request, the generated audits contain values as shown in this example.
Consider that the same allocation plan as noted above is applicable and the current inventory supply shows 100 quantity as unsegmented. The system generates and fetches the following records with auditType filter:
Further, related audit records can be obtained by querying with relatedActionId = 6a6c52da-0ad8-4d9e-859c-8a0df964a9be.
Audit record for unsegmented supply
  • relatedByActionId - 6a6c52da-0ad8-4d9e-859c-8a0df964a9be
  • auditType - SYSTEM / USER
  • purpose - SEGMENT_REALLOCATION
  • quantity - -100
Audit record for B2B segmented supply
  • relatedByActionId = 6a6c52da-0ad8-4d9e-859c-8a0df964a9be
  • auditType - SYSTEM / USER
  • purpose - SEGMENT_REALLOCATION
  • quantity - 60
  • segment - B2B
  • segmentType - Channel
Audit record for B2C segmented supply
  • relatedByActionId = 6a6c52da-0ad8-4d9e-859c-8a0df964a9be
  • auditType = SYSTEM / USER
  • purpose = SEGMENT_REALLOCATION
  • quantity = 40
  • segment = B2C
  • segmentType = Channel