I am trying to create quote product in a quote from existing products in the quote linked price list. No JS error is displayed, but the quote products are not created either.
function criaprodutolista(executionContext)
{
var formContext = executionContext.getFormContext();
var idcotacao = formContext.data.entity.getId();
var lista = formContext.getAttribute("pricelevelid").getValue()[0].id;
if(lista)
{
Xrm.WebApi.online.retrieveMultipleRecords("productpricelevel", "?$select=amount,_pricelevelid_value,_productid_value,productnumber,productpricelevelid,_uomid_value,_uomscheduleid_value&$filter=_pricelevelid_value eq '" + lista + "'").then(
function success(results)
{
for (var i = 0; i < results.entities.length; i++)
{
var amount = results.entities[i]["amount"];
var amount_formatted = results.entities[i]["amount@OData.Community.Display.V1.FormattedValue"];
var _productid_value = results.entities[i]["_productid_value"];
var _productid_value_formatted = results.entities[i]["_productid_value@OData.Community.Display.V1.FormattedValue"];
var _productid_value_lookuplogicalname = results.entities[i]["_productid_value@Microsoft.Dynamics.CRM.lookuplogicalname"];
var productnumber = results.entities[i]["productnumber"];
var productpricelevelid = results.entities[i]["productpricelevelid"];
var _uomid_value = results.entities[i]["_uomid_value"];
var _uomid_value_formatted = results.entities[i]["_uomid_value@OData.Community.Display.V1.FormattedValue"];
var _uomid_value_lookuplogicalname = results.entities[i]["_uomid_value@Microsoft.Dynamics.CRM.lookuplogicalname"];
var _uomscheduleid_value = results.entities[i]["_uomscheduleid_value"];
var _uomscheduleid_value_formatted = results.entities[i]["_uomscheduleid_value@OData.Community.Display.V1.FormattedValue"];
var _uomscheduleid_value_lookuplogicalname = results.entities[i]["_uomscheduleid_value@Microsoft.Dynamics.CRM.lookuplogicalname"];
var entity = {};
entity["productid@odata.bind"] = "/products('"+_productid_value+"')";
entity.productname = _productid_value_formatted;
entity.new_codigodoproduto = productnumber;
entity["uomid@odata.bind"] = "/uoms('"+_uomid_value+"')";
entity.priceperunit = Number(parseFloat(amount).toFixed(2));
entity["quoteid@odata.bind"] = "/quotes(3ec2f067-1cdb-e911-a812-000d3ac05a0e)";
entity.quantity = 1;
te(entity,)
}
},
function(error) {
Xrm.Utility.alertDialog(error.message);
}
);
}
//return(entity)
}
function te(entity)
{
Xrm.WebApi.online.createRecord("quotedetail", entity).then(
function success(result1) {
var newEntityId = result1.id;
},
function(error) {
Xrm.Utility.alertDialog(error.message);
}`
);
}
Я использовал собственный веб-сайт APIS Xrm.WebApi.online.retrieveMultipleRecords
Проблема не в момент создания продукта цитаты, запускается функция создания продукта цитаты, а в продукте цитатыне создается и не возвращает сообщение об ошибке. Ты поможешь мне? Спасибо.