Lookup form closes immediately

Hi 1. The ItemId field has a “lookup” method that will open the FRM InventItemIdLookupSimple. When the user clicks on the lookup button, the form is opened and the user can select an item id. public void lookup() { Args args; Object formRun; FormRun caller; ; args = new Args(); args.name(formStr(InventItemIdLookupSimple)); args.caller(element); formRun = classFactory.formRunClass(args); formRun.init(); this.performFormLookup(formRun); } 2. The salesunit field has a “modified” method that should simply open the lookup form again for the item id. When the user changes the unit, the lookup form is opened and then closed immediately. public boolean modified() { boolean ret; ret = super(); SalesLine_ItemId.setFocus(); SalesLine_ItemId.lookup(); return ret; } What should happen? → Of course the lookup form should stay available so the user can select something. There is only those 2 new methods compared to a standard Axapta. Please Note: depending on which exe version you are running, the above error occurs or not: Axapta 2.5 SP1: The error does NOT occur, the lookup form stays open. Axapta 2.5 SP4: The error occurs, lookup form closes immediately. Axapta 3.0 SP3: The error occurs, lookup form closes immediately. My question is: how can I open the lookup form of a specific field on a form when the lookup is called from a different field’s modified method ??? NB: Setting the “frame” and “window type” properties of the lookup form to “Standard” does not resolve the issue. Best regards Helmut

Hi Helmuth, What happens if right after: this.performFormLookup(formRun); you add: formRun.wait(); ? Regards, Søren

Notice to ZipCodeLookUp method of ZipCode Table. AddressMap is used when a field is modified.

If I understand the problem correctly, you want to make sure that when a user changes the sales unit, they will have to select a new product. If that is so, here is my suggestion: - make the SalesLine_ItemId a mandatory field - either on the form or on the data source. - change the public boolean modified() form your example to: public boolean modified() { boolean ret; ret = super(); SalesLine_ds.ItemId = ‘’; return ret; } The result: - the user has to always select an item before they save the data - when a user changes the unit, the itemId field will be reset => the user will get an error if they try to save the data without selecting an itemId