Hello,
I have a Problem with the subgrid element in CRM 2016.
I want to select users in a subgrid from a prefiltert lookup. But it doesnt work. i dont get an error or something like this. The looup field just doesnt filter the users in the lookup field. i use the following Java script code. Does anyone have an idear whats wrong with my code?
function filterSubGrid() { var grid = window.parent.document.getElementById("GridName");
if (grid.control != null) { |
*This post is locked for comments
Hello thanks for the quick answers.
I changed my code to :
function filterSubGrid() {
var grid = document.getElementById("grdName");
if (grid == null) {
setTimeout(filterSubGrid, 500);
return;
}
var fetchXml = "<count='50' >"
+ "<entity name='systemuser'>"
+ "<attribute ='fullname' />"
+ "<filter type='and' >"
+ "<condition attribute='isUsefull' operator='eq' value='1' />"
+ "</filter>"
+ "</entity>"
+ "</fetch>";
// change view of subgrid
grid.control.SetParameter("fetchXml", fetchXml);
grid.control.refresh();
}
I still dont get an error.
grid contains an object and is not null
1. Try using "document.getElementById("YourGridName")" instead of "window.parent.document.getElementById("GridName")"
2. If you are fetching leadId then why are you not using it in your fetch xml.
Are You want to Filter Grid based on lookup value?
1. It seems you are not passing the lookup Guid(Id) to fetchxml.
2. You getting leadid but not using it any where.
may be due to that points your filter grid not working.
As you are not getting error, it seems that your grid variable is having null value. Try debugging your code and check if below statement is giving the grid object.
window.parent.document.getElementById("GridName");
Microsoft has removed support on accessing DOM elements and hence it is not recommended. This seems to be an issue.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156