Hi thanks for the reply
i am unable to set value to field could please help me to find my error
function ProductQuantity(context) {
debugger;
var formContext = context.getFormContext();
var tempProduct = formContext.getAttribute("msdyn_product").getValue();
if (tempProduct != null) {
var proid = tempProduct[0].id;
}
var FetchXML="<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>"+
"<entity name='msdyn_productinventory'>"+
"<attribute name='createdon' />"+
"<attribute name='msdyn_warehouse' />"+
"<attribute name='msdyn_unit' />"+
"<attribute name='msdyn_qtyonhand' />"+
"<attribute name='msdyn_product' />"+
"<attribute name='msdyn_reorderpoint' />"+
"<attribute name='msdyn_qtyonorder' />"+
"<attribute name='msdyn_qtyavailable' />"+
"<attribute name='msdyn_qtyallocated' />"+
"<attribute name='msdyn_productinventoryid' />"+
"<order attribute='msdyn_product' descending='true' />"+
"<filter type='and'>"+
"<condition attribute='msdyn_product' operator='eq' uiname='0423530172J' uitype='product' value='" + proid + "' />"+
"<condition attribute='msdyn_warehouse' operator='eq' uiname='NETS-Riff_mains' uitype='msdyn_warehouse' value='{25069A0A-F382-EB11-A812-000D3AAF0EA4}' />"+
"</filter>"+
"</entity>"+
"</fetch>";
FetchXML = "?fetchXml=" + encodeURIComponent(FetchXML);
debugger;
Xrm.WebApi.retrieveMultipleRecords("msdyn_productinventory", FetchXML).then(
function success(result) {
debugger;
if(result.entities.length>0){
var totalcount= result.entities[0].msdyn_qtyavailable;
//var Pquantity=window.parent.document.getElementById("Tcount").value;
//Pquantity.innerHTML=totalcount;
formContext .getAttribute("new_test").setValue(totalcount);
}
} );
}