+ Start a Discussion
Dominic YoungDominic Young 

Why can i set opportunity line item quantity to 0

Currently we have are creating opportunity line item records as part of an integration from our quoting system.
We then have logic within the after trigger on opportunity line item that is updating the opportunity line item quantity amongst a lot of other things, however it is capable of setting the quantity to 0.

There is a SFDC system design limitation / validation that doesn't allow you to do this, however we somehow are able to. We can reproduce this issue and due to the number of transactions the ETL user does in production it isn't possible to get debug logs from it due to the limit of 20.....

Anyone's assistance in helping to get the bottom of this would be greatly appreciated. Just understanding how it is possible to bypass this system validation.

Note if we then edit that line item with a quantity of 0 within the SFDC UI we are immediately presented with the SFDC platform validation that quantity cant be 0

We have also confrimed that via the UI, apex anonymouns and a very simple trigger it isn't possible to set the quanity to 0
Rajendra RathoreRajendra Rathore
Hi Dominic,

Using "Supply default opportunity line item values" feature allow you to by pass the Quantity should be >0 validation.

But The Quantity field on opportunity line item will be defaulted with a value of 1.

See here more info regarding "How can I make Sales Price or Quantity 'optional' on an Opportunity line item":

https://help.salesforce.com/HTViewSolution?id=000004928&language=en_US (https://help.salesforce.com/HTViewSolution?id=000004928&language=en_US)


Thanks 
Dominic YoungDominic Young
Hi Rajendra,

We don't have this feature enabled as I am able to put in a quantity that is greater than 0. Also if I use the UI, dataloader or apex anonymous in the same org I get the sfdc standard error under quantity saying Error: Must be nonzero."

What i don't understand is how it is possible to bypass this validation when that feature is enabled.

Thanks