Hi All,
My requiremene is i have an optionset and a lookup in header in Case.I want to filter the lookup on the basis of optionset selected.
Thanks for any help!
*This post is locked for comments
Hi All,
My requiremene is i have an optionset and a lookup in header in Case.I want to filter the lookup on the basis of optionset selected.
Thanks for any help!
*This post is locked for comments
Hey, new to customization in Dynamics 365. is there any good blog post resource which guides us through this entire process beginning to end.
yes, i did the same ..
Xrm.Page.getControl('header_process_new_defectcategory').addPreSearch(addFilter);
Here, "header_process_new_defectcategory" is the lookup to be filtered
why you are adding presearch event with header_process_new_problemcategory optionset.?
Add presearch event for lookup which you want to filter on change of optionset.
Both are optionset
header_process_new_problemcategory is lookup? what is the type of field new_problemcategory?
Yes Arif , thanks for replying..I solved it. Here is my complete code -:
function filter_Lookup_Fields()
{
if (Xrm.Page.getControl('header_process_new_problemcategory') != null)
{
Xrm.Page.getControl('header_process_new_defectcategory').addPreSearch(addFilter);
}
}
function addFilter() {
var problemcategoryoptionset ;
var fetchQuery;
try {
problemcategoryoptionset = Xrm.Page.getControl('header_process_new_problemcategory').getAttribute().getValue();
if (Xrm.Page.getControl('header_process_new_problemcategory') != null && Xrm.Page.getControl('header_process_new_problemcategory').getAttribute().getValue() != null) {
fetchQuery = "<filter type='and'>" +
"<condition attribute='statecode' operator='eq' value='0' />" +
"<condition attribute='new_problemcategory' operator='eq' value='" + problemcategoryoptionset + "' />" +
"</filter>";
//add custom filter
Xrm.Page.getControl('header_process_new_defectcategory').addCustomFilter(fetchQuery);
}
}
catch (e) {
Xrm.Utility.alertDialog('addFilter Error: ' + (e.description || e.message));
}
}
did you solve your error? if not please share your code and tell me complete requirement.
Hi,
Could you please share your the resolution here so that it can help others?
Thanks All for replies...I resolved it..
Hi CRM Beginner,
Post your whole code, if possible so that we are able to find what is wrong?
Thanks
Regards,
AW
André Arnaud de Cal...
292,516
Super User 2025 Season 1
Martin Dráb
231,387
Most Valuable Professional
nmaenpaa
101,156