My Products
Help
Sigbjørn Eide
CONTRIBUTOR ***

Adding new line in StockTake v2 fails

by Sigbjørn Eide

Hi,

 

It seems like adding new lines to a StockTake using operation = insert with PUT v2/StockTake is broken. It used to work just fine and I'm not sure when it stopped working, but it might be related to the improved error handling changes made a while back.

 

Reproducible test:

Sigbjrn_E_1-1658947628568.png

 

Stocktake with only one line. When I try to update this line and add another line with a different location (that is defined in the Physical Inventory Type and valid - works in UI) with the following request:

{
   "lines":[
      {
         "physicalQuantity":{
            "value":5.0
         },
         "operation":"Insert",
         "inventoryId":{
            "value":"109"
         },
         "locationId":{
            "value":"1A"
         }
      },
      {
         "lineNbr":{
            "value":"1"
         },
         "physicalQuantity":{
            "value":3.0
         },
         "operation":"Update"
      }
   ]
}

I get the following error: "Error: An error in processing of field Location value 1A Inventory error: This combination is already in use in line number 2."

 

It seems like it fails validating against it self.

4 REPLIES 4
Accepted solution
Sigbjørn Eide
CONTRIBUTOR ***

by Sigbjørn Eide

Fix released a while back. Seems to be working like expected again.

by Magnus Johnsen

The issue only seems to be happening when there are operations after the insert.

For example this payload goes through as it should:

 
View more
{
   "lines":[
             {
         "lineNbr":{
            "value":"1"
         },
         "physicalQuantity":{
            "value":2466.0
         },
         "operation":"Update"
      },
            {
         "lineNbr":{
            "value":"2"
         },
         "physicalQuantity":{
            "value":2466.0
         },
         "operation":"Update"
      },
      {
         "physicalQuantity":{
            "value":2.0
         },
         "operation":"Insert",
         "inventoryId":{
            "value":"Teststock"
         },
         "locationId":{
            "value":"2"
         }
      }
   ]
}
 

Whereas this causes issues:

 
View more
{
    "lines": [
        {
            "lineNbr": {
                "value": "1"
            },
            "physicalQuantity": {
                "value": 2466.0
            },
            "operation": "Update"
        },
        {
            "physicalQuantity": {
                "value": 2.0
            },
            "operation": "Insert",
            "inventoryId": {
                "value": "Teststock"
            },
            "locationId": {
                "value": "2"
            }
        },
        {
            "lineNbr": {
                "value": "2"
            },
            "physicalQuantity": {
                "value": 2466.0
            },
            "operation": "Update"
        },
    ]
}
 

The same issue occurs if there are several inserts in the same payload.

For the moment, the workaround is to only include one "insert" line per payload, and always as the last operation.

 

We'll open a case with the development team so they can investigate it.

Thank you. 

Sigbjørn Eide
CONTRIBUTOR ***

by Sigbjørn Eide

Thanks.

 

Additional information:
It seems like it fails if the request contains a line after a line with operation = insert.
Update - Insert = OK
Update - Update - Insert = OK
Insert - Update = Error
Update - Insert - Update = Error
Update - Insert - Insert = Error

 

by Magnus Johnsen

Hi,

We'll have a look at it and get back to you.

Thank you.