Добрый день, коллеги!
Есть задача: фильтровать записи в SubGrid в зависимости от значения поля с типом набор параметров.
Проблема на финальной стадии, когда я пытаюсь установить setParameter мне выдает что объект не поддерживает свойство или метод или не удалось получить свойство "SetParameter" ссылки, значение которой не определено или является NULL.
Вот сам код:
Цитата:
function filterSubGrid() {
//var accountsGrid = document.getElementById("new_dogovorGrid"); //grid to filter
var Casko = 100000001;
var Osago = 100000000;
var reguestGrid =Xrm.Page.ui.controls.get('new_dogovorGrid')._control;
debugger;
if (reguestGrid == null) { //make sure the grid has loaded
setTimeout(function () { updateSubGrid(); }, 2000); //if the grid hasn’t loaded run this again when it has
return;
}
var accountValue = Xrm.Page.getAttribute("new_account").getValue(); //field to filter by
var ProductValue = Xrm.Page.getAttribute("new_insurance_product").getValue(); //field to filter by
var accountId = "00000000-0000-0000-0000-000000000000"; //if filter field is null display nothing
if (accountValue != null && (ProductValue == Casko || ProductValue == Osago)) {
var accountId = accountValue[0].id;
}
//fetch xml code which will retrieve all the accounts related to the contact
var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>" +
" <entity name='new_request'>" +
" <attribute name='new_requestid' />" +
" <attribute name='new_insurance_product' />" +
" <attribute name='new_insuransepayment' />" +
" <attribute name='new_total_limit' />" +
" <attribute name='new_client_account' />" +
" <order attribute='new_insurance_product' descending='false' />" +
" <filter type='and'>" +
" <condition attribute='new_client_account' operator='eq' uitype='account' value='" + accountId + "' />" +
" <condition attribute='new_insurance_product' operator='eq' value='" + ProductValue + "'/>" +
" <condition attribute='new_stage' operator='eq' value='100000006' />" +
" <condition attribute='new_result' operator='eq' value='1' /> " +
" </filter>" +
" </entity>" +
"</fetch>";
если пишу так - то объект не поддерживает свойство или метод
reguestGrid.setParameter("fetchXml", fetchXml); -
reguestGrid.refresh(); //refresh the sub grid using the new fetch xml
если пишу так - то не удалось получить свойство "SetParameter" ссылки, значение которой не определено или является NULL.
// reguestGrid.control.SetParameter("fetchXml", fetchXml); //set the fetch xml to the sub grid
// reguestGrid.control.refresh(); //refresh the sub grid using the new fetch xml
}