Error message: More than one form was opened at once for the lookup control. in lookup in D365 F&O
If you get error message (More than one form was opened at once for the lookup control.) in notification Action Centre while clicking on lookup button in D365 then you just need to call a peace of code just after lookup performs.
//cancel super() to prevent error.
FormControlCancelableSuperEventArgs cancelEventArgs = e as FormControlCancelableSuperEventArgs;
cancelEventArgs.CancelSuperCall();
For example - Lookup method:
[FormControlEventHandler(formControlStr(EcoResProductDetailsExtended, InventTable_HSNRFColorCode), FormControlEventType::Lookup)]
public static void InventTable_HSNFRColorCode_OnLookup(FormControl sender, FormControlEventArgs e)
{
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
SysTableLookup sysTableLookup;
sysTableLookup = SysTableLookup::newParameters(tableNum(HSNRFColorCodes), sender);
queryBuildDataSource = query.addDataSource(tableNum(HSNRFColorCodes));
sysTableLookup.addLookupField(fieldNum(HSNRFColorCodes, NRFColorCode));
sysTableLookup.addLookupField(fieldNum(HSNRFColorCodes, NRFColorGroup));
sysTableLookup.addLookupField(fieldNum(HSNRFColorCodes, Description));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
// If you get error message (More than one form was opened at once for the lookup control.) in notification Action Centre then call below one line code.
//cancel super() to prevent error.
FormControlCancelableSuperEventArgs cancelEventArgs = e as FormControlCancelableSuperEventArgs;
cancelEventArgs.CancelSuperCall();
}
Happy DAXing...
No comments:
Post a Comment