Hi,
Am applying filters on the option-set to get the lookup field value. here is the code:
function SetFilterLookup() {//debugger;
if ((Xrm.Page.getAttribute("optionsetval").getSelectedOption() != null)&&(Xrm.Page.getAttribute("lookup1").getValue() != null)) {
var _Text = Xrm.Page.getAttribute("optionsetval").getSelectedOption().text;
if(_Text=='title')
_Text='title_name';
var _Value = Xrm.Page.getAttribute("optionsetval").getSelectedOption().value;
var countyId= Xrm.Page.getAttribute("lookup1").getValue()[0].id;
//alert(guid_lkp);
var viewId = '{30A7616D-6A84-E211-0000-0000569C13E4}';
var entityName = "contact";
var viewDisplayName = "Active contacts for " + _Text;
var fetchXml = "
.....
.......
....";
//build grid layout
var layoutXml = "....
.....
..
";
//add new view
Xrm.Page.getControl("lookup2").addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, true);
}
}
everything works fine until i save the form, the lookup2 which am setting to the form is going empty. any help would greatly be appreciated