API Forum

This forum is in read-only mode.
Please refer to our API support in case you have any questions.
We can be reached at api@e-conomic.com
e-conomic API developer forum

A product must be set before the quantity on an order line


I am getting the below error:

{A product must be set before the quantity on an order line. (id=1440878712)}

It is based on the following code.

foreach (ic1801_order_detail od in orderLines)
                IOrderLineData orderLine = _sessionOrderLineDataCreate(orderCreated);
                orderLineOrderCurrency = currency;
                string productId = 2000;
                if (odproduct_supplier_reference != null)
                    if (odproduct_supplier_referenceLength  0)
                        productId = odproduct_supplier_reference;
                orderLineProduct = _sessionProductFindByNumber(productId);
                orderLineQuantity = odproduct_quantity;
                orderLineUnitNetPrice = odproduct_price;
                orderLineDescription = odproduct_name;
                IOrderLine orderLineCreated = _sessionOrderLineCreateFromData(orderLine);

My problem is, that the productid is found in the line, so I do not understand why the error occurs:
orderLine.Product = _session.Product.FindByNumber(productId);

When I look into the database it seems like the product has been added to the order.

Any idea, why I have this problem would be appreciated, since I do not understand the cause of this problem. Im using VS2010 SP1

created Feb 15, 2013 by dcasso
0% Accept Rate
Q 1 A 0 C 0

2 Answers

Hi Dennis,

I need you to double check the product on the orderline.

I have just checked the logs and there is no product in the SOAP request that the error code you gave refers to.

Seems like you are creating more than one orderline - maybe one of them has a missing product?
answered Feb 18, 2013 by nkn
hi ,

when looping order_line data ,

 you are not getting the value of product_id.

you got error : in the bellow line only ..

  orderLineProduct = _sessionProductFindByNumber(productId);

you just check , with out loop

is product_id is getting or not,

just put as static and then dynamically insert data .


answered Mar 30, 2013 by sudheerphp
Visma e-conomic A/S