Class ProductInventoryRecord
dw.catalog
Class ProductInventoryRecord
The ProductInventoryRecord holds information about a Product's inventory, and availability.

When using Omnichannel Inventory (OCI):

  • All ProductInventoryRecord properties are read-only. Calling any setter method throws an IllegalStateException.
  • The ProductInventoryRecord class does not support custom properties.
  • isPerpetual() and isPreorderable() always return false.

Properties
allocation  :  Quantity
The allocation quantity that is currently set. The quantity unit is the same unit as the product itself.

When using OCI, returns the physically available quantity. Corresponds to the On Hand quantity in OCI.

allocationResetDate  :  Date  (Read Only)
The date the allocation quantity was initialized or reset.

When using OCI, corresponds to the Effective Date in OCI. The value can be null.

ATS  :  Quantity  (Read Only)
The quantity of items available to sell (ATS). This is calculated as the allocation (getAllocation()) plus the preorderBackorderAllocation (getPreorderBackorderAllocation()) minus the turnover (getTurnover()) minus the on order quantity (getOnOrder()).

When using OCI, corresponds to the ATO (Available To Order) quantity in OCI.

backorderable  :  boolean
Determines if the product is backorderable.

When using OCI, returns true if the product has at least one Future quantity in OCI.

custom  :  CustomAttributes  (Read Only)
The custom attributes for this object. The returned object is used for retrieving and storing attribute values. See CustomAttributes for a detailed example of the syntax for working with custom attributes.

When using Omnichannel Inventory (OCI), this class doesn't support custom attributes. If OCI is enabled, then attempting to set or modify a custom attribute value throws an UnsupportedOperationException.

inStockDate  :  Date
The date that the item is expected to be in stock.

When using OCI, returns the date of the earliest Future quantity. If the product has no Future quantities, it returns null.

onHand  :  Quantity  (Read Only)
The on-hand quantity, the actual quantity of available (on-hand) items.
Deprecated:
Use getStockLevel() instead.
onOrder  :  Quantity  (Read Only)
The quantity that is currently on order.

This is only relevant when On Order Inventory is turned on for the related inventory list. On Order is a bucket of inventory used for the time between order creation and order export to external (warehouse) systems. On Order value is increased when an order is created. It will be decreased and with that turnover will be increased when the order is exported, see getTurnover(). Notice that Order.setExportStatus(Number) and OrderItem.allocateInventory(Boolean) will decrease the On Order value. On order will be included in the ATS calculation, see getATS().

When using OCI, always returns zero. OCI doesn't support On Order inventory.

perpetual  :  boolean
Determines if the product is perpetually in stock.

When using OCI, always returns false.

preorderable  :  boolean
Determines if the product is preorderable.

When using OCI, always returns false.

preorderBackorderAllocation  :  Quantity
The quantity of items that are allocated for sale, beyond the initial stock allocation.

When using OCI, returns the sum of all Future quantities. If the product has no Future quantities, it returns zero.

reserved  :  Quantity  (Read Only)
The quantity of items that are reserved.

Note that for products with high velocity and concurrency, the return value is extremely volatile and the retrieval will be expensive.

When using OCI, always returns zero.

stockLevel  :  Quantity  (Read Only)
The current stock level. This is calculated as the allocation minus the turnover.

When using OCI, corresponds to the ATF (Available To Fulfill) quantity in OCI.

turnover  :  Quantity  (Read Only)
The sum of all inventory transactions (decrements and increments) recorded after the allocation reset date. If the total decremented quantity is greater than the total incremented quantity, then this value is negative.

When using OCI, returns the total reserved quantity, including order, basket, and temporary reservations.

Constructor Summary
This class does not have a constructor, so you cannot create it directly.
Method Summary
describe() : ObjectTypeDefinition
Returns the meta data of this object.
getAllocation() : Quantity
Returns the allocation quantity that is currently set.
getAllocationResetDate() : Date
Returns the date the allocation quantity was initialized or reset.
getATS() : Quantity
Returns the quantity of items available to sell (ATS).
getCustom() : CustomAttributes
Returns the custom attributes for this object.
getInStockDate() : Date
Returns the date that the item is expected to be in stock.
getOnHand() : Quantity
Returns the on-hand quantity, the actual quantity of available (on-hand) items.
getOnOrder() : Quantity
Returns the quantity that is currently on order.
getPreorderBackorderAllocation() : Quantity
Returns the quantity of items that are allocated for sale, beyond the initial stock allocation.
getReserved() : Quantity
Returns the quantity of items that are reserved.
getStockLevel() : Quantity
Returns the current stock level.
getTurnover() : Quantity
Returns the sum of all inventory transactions (decrements and increments) recorded after the allocation reset date.
isBackorderable() : boolean
Determines if the product is backorderable.
isPerpetual() : boolean
Determines if the product is perpetually in stock.
isPreorderable() : boolean
Determines if the product is preorderable.
setAllocation(quantity : Number) : void
Sets the allocation quantity.
setAllocation(quantity : Number, allocationResetDate : Date) : void
Sets the allocation quantity.
setBackorderable(backorderableFlag : boolean) : void
The method is used to set whether the product is backorderable.
setInStockDate(inStockDate : Date) : void
Sets the date that the item is expected to be in stock.
setPerpetual(perpetualFlag : boolean) : void
Sets if the product is perpetually in stock.
setPreorderable(preorderableFlag : boolean) : void
The method is used to set whether the product is preorderable.
setPreorderBackorderAllocation(quantity : Number) : void
Sets the quantity of items that are allocated for sale, beyond the initial stock allocation.
Methods inherited from class ExtensibleObject
Methods inherited from class PersistentObject
Method Detail
describe
describe() : ObjectTypeDefinition
Returns the meta data of this object. If no meta data is available the method returns null. The returned ObjectTypeDefinition can be used to retrieve the metadata for any of the custom attributes.

When using Omnichannel Inventory (OCI), this class doesn't support custom attributes. If OCI is enabled, then attempting to set or modify a custom attribute value throws an UnsupportedOperationException.

Returns:
the meta data of this object. If no meta data is available the method returns null.

getAllocation
getAllocation() : Quantity
Returns the allocation quantity that is currently set. The quantity unit is the same unit as the product itself.

When using OCI, returns the physically available quantity. Corresponds to the On Hand quantity in OCI.

Returns:
the allocation quantity or quantity N/A if not available.

getAllocationResetDate
getAllocationResetDate() : Date
Returns the date the allocation quantity was initialized or reset.

When using OCI, corresponds to the Effective Date in OCI. The value can be null.

Returns:
the allocation reset date.

getATS
getATS() : Quantity
Returns the quantity of items available to sell (ATS). This is calculated as the allocation (getAllocation()) plus the preorderBackorderAllocation (getPreorderBackorderAllocation()) minus the turnover (getTurnover()) minus the on order quantity (getOnOrder()).

When using OCI, corresponds to the ATO (Available To Order) quantity in OCI.

Returns:
the quantity or quantity N/A if not available.

getCustom
getCustom() : CustomAttributes
Returns the custom attributes for this object. The returned object is used for retrieving and storing attribute values. See CustomAttributes for a detailed example of the syntax for working with custom attributes.

When using Omnichannel Inventory (OCI), this class doesn't support custom attributes. If OCI is enabled, then attempting to set or modify a custom attribute value throws an UnsupportedOperationException.

Returns:
the custom attributes for this object.

getInStockDate
getInStockDate() : Date
Returns the date that the item is expected to be in stock.

When using OCI, returns the date of the earliest Future quantity. If the product has no Future quantities, it returns null.

Returns:
the date that the item is expected to be in stock.

getOnHand
getOnHand() : Quantity
Returns the on-hand quantity, the actual quantity of available (on-hand) items.
API Versioned:
No longer available as of version 21.7.
Deprecated:
Use getStockLevel() instead.
Returns:
the on-hand quantity or quantity N/A if not available.

getOnOrder
getOnOrder() : Quantity
Returns the quantity that is currently on order.

This is only relevant when On Order Inventory is turned on for the related inventory list. On Order is a bucket of inventory used for the time between order creation and order export to external (warehouse) systems. On Order value is increased when an order is created. It will be decreased and with that turnover will be increased when the order is exported, see getTurnover(). Notice that Order.setExportStatus(Number) and OrderItem.allocateInventory(Boolean) will decrease the On Order value. On order will be included in the ATS calculation, see getATS().

When using OCI, always returns zero. OCI doesn't support On Order inventory.

Returns:
the quantity or quantity N/A if not available.

getPreorderBackorderAllocation
getPreorderBackorderAllocation() : Quantity
Returns the quantity of items that are allocated for sale, beyond the initial stock allocation.

When using OCI, returns the sum of all Future quantities. If the product has no Future quantities, it returns zero.

Returns:
the quantity or quantity N/A if not available.

getReserved
getReserved() : Quantity
Returns the quantity of items that are reserved.

Note that for products with high velocity and concurrency, the return value is extremely volatile and the retrieval will be expensive.

When using OCI, always returns zero.

Returns:
the quantity of items reserved for this product.

getStockLevel
getStockLevel() : Quantity
Returns the current stock level. This is calculated as the allocation minus the turnover.

When using OCI, corresponds to the ATF (Available To Fulfill) quantity in OCI.

Returns:
the stock level or quantity N/A if not available.

getTurnover
getTurnover() : Quantity
Returns the sum of all inventory transactions (decrements and increments) recorded after the allocation reset date. If the total decremented quantity is greater than the total incremented quantity, then this value is negative.

When using OCI, returns the total reserved quantity, including order, basket, and temporary reservations.

Returns:
the turnover or quantity N/A if not available.

isBackorderable
isBackorderable() : boolean
Determines if the product is backorderable.

When using OCI, returns true if the product has at least one Future quantity in OCI.

Returns:
true if the product is backorderable.

isPerpetual
isPerpetual() : boolean
Determines if the product is perpetually in stock.

When using OCI, always returns false.

Returns:
true if the product is perpetually in stock.

isPreorderable
isPreorderable() : boolean
Determines if the product is preorderable.

When using OCI, always returns false.

Returns:
true if the product is preorderable.

setAllocation
setAllocation(quantity : Number) : void
Sets the allocation quantity. This also updates the allocation reset date.
All final reservations will be considered as expired and will therefore no longer be considered for ATS.

When using OCI, throws an IllegalStateException.
This method should not be called within a storefront request.

API Versioned:
No longer available as of version 21.7.
Parameters:
quantity - the allocation quantity to set (must be greater than or equal to zero).

setAllocation
setAllocation(quantity : Number, allocationResetDate : Date) : void
Sets the allocation quantity. This also updates the allocation reset date.
Any final reservations made prior to the allocation reset date will be considered as expired and will therefore no longer be considered for ATS.

When using OCI, throws an IllegalStateException.
This method must not be called within a storefront request.

Parameters:
quantity - the allocation quantity to set (must be greater than or equal to zero).
allocationResetDate - the date allocation quantity was effectively calculated
  • the reset date must not be older than 48 hours
  • the reset date must not be older than the prior reset date. see getAllocationResetDate()

setBackorderable
setBackorderable(backorderableFlag : boolean) : void
The method is used to set whether the product is backorderable. Setting the backorderable flag to true will clear the preorderable flag. If the record's preorderable flag is set to true, calling this method with backorderableFlag==false will have no effect.

When using OCI, throws an IllegalStateException.
This method should not be called within a storefront request.
This method must not be called within a storefront request when the API version is 21.7 or later.

Parameters:
backorderableFlag - the flag to set backorderable status.

setInStockDate
setInStockDate(inStockDate : Date) : void
Sets the date that the item is expected to be in stock.

When using OCI, throws an IllegalStateException.
This method should not be called within a storefront request.
This method must not be called within a storefront request when the API version is 21.7 or later.

Parameters:
inStockDate - the date that the item is expected to be in stock.

setPerpetual
setPerpetual(perpetualFlag : boolean) : void
Sets if the product is perpetually in stock.

When using OCI, throws an IllegalStateException.
This method should not be called within a storefront request.
This method must not be called within a storefront request when the API version is 21.7 or later.

Parameters:
perpetualFlag - true to set the product perpetually in stock.

setPreorderable
setPreorderable(preorderableFlag : boolean) : void
The method is used to set whether the product is preorderable. Setting the preorderable flag to true will clear the backorderable flag. If the record's backorderable flag is set to true, calling this method with preorderableFlag==false will have no effect.

When using OCI, throws an IllegalStateException.
This method should not be called within a storefront request.
This method must not be called within a storefront request when the API version is 21.7 or later.

Parameters:
preorderableFlag - the flag to set preorderable status.

setPreorderBackorderAllocation
setPreorderBackorderAllocation(quantity : Number) : void
Sets the quantity of items that are allocated for sale, beyond the initial stock allocation.

When using OCI, throws an IllegalStateException.
This method should not be called within a storefront request.
This method must not be called within a storefront request when the API version is 21.7 or later.

Parameters:
quantity - the quantity to set.