Before opening a new ticket, please verify SureDone status at https://status.suredone.com and also review our helpful articles below.

Start a new topic
Answered

Automation API3 Negative stock

One of the manufacturer we work with also uses negative stock values, so I wanted to see how can we set those to 0? Or will the system accept negative stock value?


Sometimes Qty_Available is a negative number. This Automation runs withour any error, but the stock field is not updated in SD admin.


this is what I have for now: 


"file_configs":

{

"regex":"/SPYDER INV 06-03-2020-test*.xls/",

"identifier":"upc",

"search":"guid:FCLH",

"diff_update": 1,

"diff_fields":["stock"],

"field_map":{

 "stock":" Qty_Available"

},

"stock_field":"stock",

"stock_negative":true,

"missing_vendor_items":"zeroStock",

"update":"edit"

}


Any advise is appreciated.


Best Answer

Hey Erno, just to clarify, `stock_negative` defaults to `true`, which allows for negative stock. If you set it explicitly to `false`, the result in SD should be 0. Also note that you must explicitly set the "stock_field" config for this to work, so in the config it would be:

"stock_field": "stock",

"stock_negative": false


I solved the issue: if one have negative stock value ( example:  -3) in the CSV file or any other inventory file,  then use, "stock_negative":true;. The result is will be 0 in SD.



Answer

Hey Erno, just to clarify, `stock_negative` defaults to `true`, which allows for negative stock. If you set it explicitly to `false`, the result in SD should be 0. Also note that you must explicitly set the "stock_field" config for this to work, so in the config it would be:

"stock_field": "stock",

"stock_negative": false

I experience it differently:


I receive negative sock values, and if I set "stock_negative: true, then in SD the stock value will be 0. tested it like 100 times:). Basically I experience the opposite what you are saying.

Any idea why would you say what you said and I experience the opposite?

Qty_Available
1
1
-5
-5
-5
117

Hey Erno, can you double-check your config and try a couple debug runs on the automation and check the resulting files?

Looking at your automation ID 856, I see that "stock_negative" is currently set to "true" (it may display as 1). Trying a debug run (which produces a bulk file without processing it), I can see the following results (example of the first few):


action,guid,stock

relist,FCLH5XXXX,-2

relist,FCLH5XXXX,-2

relist,FCLH5XXXX,7

relist,FCLHXXXX,9

So there are negative values in the bulk file. When negative values are processed, they decrement from the current value in the stock field.

If you change the config to have "stock_negative" set to "false", you should see the following results in the bulk file instead:

action,guid,stock

relist,FCLH5XXXX,0

relist,FCLH5XXXX,0

relist,FCLH5XXXX,7

relist,FCLHXXXX,9

Finally, note that our stock fields don't allow for negative stock, so while the negative values in the bulk file will decrement from the current stock value, the final result value in SD itself won't go below 0.

Let me know if that clarifies things, and if you want you can provide an automation ID we can test together to confirm!


1 person likes this

Thanks, this seems to work,


I set every item to 4, used  "stock_negative": true and also false to see the difference; thanks!

Login or Signup to post a comment