How to create a Quote Order using NAV web services?

Hi, I have a problem trying to create a Quote Order, this is my code:

// Create Web Service Reference
WS_Cotizacion.cotizacionVenta_Service service = new WS_Cotizacion.cotizacionVenta_Service();
service.UseDefaultCredentials = true;

//Create header Quote
pedidosVenta nuevoPedido = new pedidosVenta();
WS_Cotizacion.cotizacionVenta nuevaCotizacion = new WS_Cotizacion.cotizacionVenta();
service.Create(ref nuevaCotizacion);

//Update header Quote
nuevaCotizacion.Sell_to_Customer_No = cbClientes.SelectedValue.ToString();

//Create quoteLines
int lineas = 0;
foreach (DataGridViewRow fila in dataGrid.Rows)
{
if (fila.Cells[1].Value != null)//if row of dataGrid is not empty
{
lineas++;   //Number of quoteLineas to create
}
}

nuevaCotizacion.SalesLines = new WS_Cotizacion.Sales_Quote_Line[lineas];

for (int i = 0; i < lineas; i++)
{
nuevaCotizacion.SalesLines[i] = new WS_Cotizacion.Sales_Quote_Line();
}
service.Update(ref nuevaCotizacion);

//Update quotesLines whit products
//Inserta los productos en cada línea
for (int i = 0; i < lineas; i++)
{
nuevaCotizacion.SalesLines[i].Type = WS_Cotizacion.Type.Item;
nuevaCotizacion.SalesLines[i].No = dataGrid.Rows[i].Cells["codigo"].Value.ToString();
nuevaCotizacion.SalesLines[i].Quantity = Convert.ToInt32(dataGrid.Rows[i].Cells["cantidad"].Value.ToString());
//nuevaCotizacion.SalesLines[i].Qty_to_Assign = Convert.ToInt32(dataGrid.Rows[i].Cells["cantidad"].Value.ToString()); ;
//nuevaCotizacion.SalesLines[i].Qty_to_Ship = Convert.ToInt32(dataGrid.Rows[i].Cells["cantidad"].Value.ToString()); ;
nuevaCotizacion.SalesLines[i].Total_Amount_Incl_VATSpecified = false;
nuevaCotizacion.SalesLines[i].Total_Amount_Excl_VATSpecified = false;
nuevaCotizacion.SalesLines[i].Total_VAT_AmountSpecified = false;
//nuevaCotizacion.SalesLines[i].LineDiscExists = false;
}
service.Update(ref nuevaCotizacion);
service.PostQuotes(nuevaCotizacion.Key);

 

The Code works fine, but NAV returns this error: Field LineDiscExists is readonly!

I use the same code to create a SalesOrder and I have to delete “FieldSalesLineDiscExist” from page 46 and works fine but QuoteOrders doesn’t

Hi,
If you check the properties of the “SalesLineDiscExists” field in the page 43, you will find the reason for the issue. In the page level Editable property of the field has set to false. That is the reason that you been not been able to update the field using a web service.