Try our conversational search powered by Generative AI!

What happends "under the hood" in AdjustInventoryOrRemoveLineItems


question to EPiServer mostly i guess.


what does it do? 

does it makes "RequestInventory", can someone explain when and what is does more exactly?



Nov 15, 2017 9:31

My tip to you if you want to find out what something does "under the hood" in epi is just to decompile it using Jetbrains dotPeek or ilSpy or something similar, and just read code :)

Nov 15, 2017 9:57

I think I explained this in my book.

I also explain it partly here (comments)

Basically RequestInventory will ask the inventory system: "Hi inventory system, this kind Goaral is buying 3 of this SKU. Can you allocate the stock for him so we can ship?". And the inventory system will be "OK, 3 requested and allocated", Or "We only have 2, but 1 can be backordered". This will happen when you actually place your order. The allocated inventory will be "committed" when the shipment is shipped, or will be reverted if you cancel the order before that. 

It can be much more complicated underneath if you think about edge cases, but that is basically the idea.

Nov 15, 2017 10:12

Thank you for your tip Joel, but i already did that before i posted this post and it takes to much time digging, this post is my shortcut.. even tho i like digging i dont really have time for this in my project right now. 

Nov 15, 2017 10:21

Quan, what makes me confused is that "PurchaseRequestedQuantity" is not reduced aven when we call the

       _inventoryProcessor.AdjustInventoryOrRemoveLineItem(shipment, purchaseOrder.OrderStatus, (item, issue) => validationIssues.Add(item, issue));

both shipment is shipped and order completed but nothing happends.. 

from my understanding is should make a "CompleteInventoryRequest" 

that should decrease the "PurchaseRequestedQuantity"? 

Nov 15, 2017 10:41

I'm a bit confused here. Once the shipment is shipped (and the order is completed), you should not have to call AdjustInventoryOrRemoveLineItem. That is supposed to call only during check out process.

Once the order is completed the OperationKeys are cleared so the requests will not be changed at all. 

Nov 15, 2017 10:48

Ok, so when and how should the PurchaseRequestedQuantity from InventoryRecord be decreased? 

Nov 15, 2017 10:51

My bad. AdjustInventoryOrRemoveLineItem also do the job of "completing orders"  (It should have been a different API). So what you did was correct, when the Shipment status = Shipped, OR Order status = Completed, then it will complete the request (by committing the requested quantity).

However that can only be done if the Shipment.OperationKeys is not empty ... 

Nov 15, 2017 11:00

and the way working with the OperationKeys

are they set when we make first AdjustInventoryOrRemoveLineItem on cart or is that a manual job by calling "RequestInventory" and then setting them to shipments

i tried to debug in different scenarions but hey never get set.. 

Nov 15, 2017 11:17

When you call ReserveInventory - which is called inside AdjustInventoryOrRemoveLineItem when you place the order, it should do all the work for you (request inventory, add operation keys to the shipment...)

Check in your database if the OperationKeys is there

Nov 15, 2017 11:24

hmm.. ok they are not set when i run AdjustInventoryOrRemoveLineItem on cart.. and they are not there i the table either..

Nov 15, 2017 11:48

is this a bug, do you know what version it´s fixed in?  

Nov 15, 2017 11:57

I don't think there was a bug regarding to that. We tested this area very intensively and such bug should be caught early.

To make sure, did you look into Shipment table, column OperationKeys?

Can you try with the vanila Quicksilver setup to see if it works? 

Nov 15, 2017 11:59

ok, i tried this on Quicksilver but it was working fine there.. 

I copied the exact code from Quicksilver but still its not set.. 

is there any requirementson on the shipment that needs to be set in order to set Operationkeys? 

we run 10.2 commerce version 

Nov 15, 2017 13:28

the difference i could see is we have created a shipment line in DB before calling the Adjust method and in QUicksilver that is first created when a order is placed. 

does it matter? maybe it cannot exist in the DB before we call adjust method in order to have it set.. ?

Nov 15, 2017 14:23

It should not be a problem.

However it seems it's in your implementation - I would suggest to contact developer support service for a more throughout investigation. 

Nov 15, 2017 14:51
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.