How to filter one webLookup based on other.

Hello, I want to customize the sales order creation webform in Enterprise Portal for multiple lookups e.g. User will first select an itemgroup from itemgroup lookup, and the itemid lookup should be filtered based on the itemgroupid. I’m able to get the value in my WebLookupWeblet class i.e. using javascript opener.document function but i’m not able to assign this value to one of my X++variables in axapta. e.g.Please see the code snippet (I’m trying to get the itemgroupid using opener method so that i can filter the itemid based on these values) webSession().writeTxt(‘valh=’+opener+wf.name()+’.’+wf.controlName(SalesTable_ItemGroupID)+’.value;}\n’); What, I’m trying to do here is assign the itemgroupid value into variable called valh so that I can use this variable as a filter to model group and item lookups. Any help would be appreciated. Thanks and Regards, Dilip

I found a workaround to this problem by using a hidden variable and then retreiving the value by websession().getparm() in my x++ code. regards, dilip

Hey Dilip, Why aren’t you using the existing functionality ? couldn’t you set the lookup method property on the “item id” to custom, and lookup field of “iteme Id” to “item group” and then overwrite the lookup method on the “item id” control to filter base on the item group? Regards, Vlad.

Hey Vlad, It’s not that straight. I have to first filter model and size based on itemgroup and then filter itemid based on the above 3 filters i.e. group,model and size. If it was just between itemid and itemgroup , i could have very well used addlink and addrange methods. But, since model and group tables doesnt have a relation field, i have to first link it thru item table and then im passing the range value which i get from the group lookup. Regards, Dilip

Oh, I see where you are comming from… damn… Listen Dilip, can you post some code on how you did it, and include the methods that you are overwriting, if it’s not too much to ask. Potentially I can come across the same issue… Thanks, Vlad.

Hey Vlad, I have customized the weblookupweblet class run method to achieve my purpose of filter and to pass parameters I customized the webformHtml class layoutedit method. e.g. for inventtable, the filter code is (assuming that code for linking and fetching is done) if(reltable==tablenum(InventTable)) { qbds.addRange(fieldnum(InventTable,itemid)).value(websession.getParm(‘ItemID’)); }