В моем сценарии у меня есть новый объект под названием «new_relations» с 2 полями (account1 и account2), которые являются как поисками для учетных записей. В моей учетной записи я хочу отображать сетку, содержащую любую запись с текущей учетной записью, в любом из двух поисковых запросов, который существует в сущности «new_relations». Я создал учетную запись A и учетную запись B; создал 1 запись в new_relations с помощью new_relations.account1 = account A и new_relations.account2 = account B. Итак, когда я открываю счет A или учетную запись B, я хочу видеть запись, созданную в new_relations.CRM 2013 обновить subgrid с fetchxml
У меня есть следующий код, к сожалению, его единственный показ записи в форме Абонента в моей подсети ... Может ли кто-нибудь помочь?
function FilterRelacao(){
var relacoes = document.getElementById("Relacoes");
var account = Xrm.Page.data.entity.getId();
var accountname = Xrm.Page.data.entity.attributes.get("name").getValue();
if(relacoes==null){
setTimeout(function() { FilterRelacao(); }, 2000);
return;
}
var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>" +
"<entity name='new_relations'>" +
"<attribute name='new_type' />" +
"<attribute name='new_accountid1' />" +
"<attribute name='new_accountid2' />" +
"<attribute name='new_relationsid' />" +
"<order attribute='new_accountid1' descending='true' />" +
"<filter type='and'>" +
"<condition attribute='statecode' operator='eq' value='0' />" +
"<filter type='or'>" +
"<condition attribute='new_accountid1' operator='eq' uitype='account' uiname='" + accountname+ "' value='" + account + "' />" +
"<condition attribute='new_accountid2' operator='eq' uitype='account' uiname='" + accountname + "' value='" + account + "' />" +
"</filter></filter>" +
"</entity>" +
"</fetch>";
relacoes.control.SetParameter("fetchXml", fetchXml); //set the fetch xml to the sub grid
relacoes.control.SetParameter("effectiveFetchXml", fetchXml); //set the fetch xml to the sub grid
relacoes.control.Refresh(); //refresh the sub grid using the new fetch xml
}
Это действительно проблема! Так просто! Спасибо большое! –
Рад, что я мог бы помочь, у меня случилось то же самое несколько месяцев назад :) – Zach