In Dynamics 365 for Finance and Operations, when subscribing to
a lookup event to modify an existing lookup on a form control, you must remove
the super call to the existing lookup. Otherwise, when clicking on the control
a message will display stating, “More than one form was opened at once for the
lookup control.” An example of the message is shown in the upper right corner
of the image below.
Use the following steps in the lookup event to cancel the super
call of the original lookup:
·
Declare a new variable of type
FormControlCancelableSuperEventArgs.
·
Initialize the new variable with the
current FormControlEventArgs parameter ‘e’ and cast it as type
FormControlCancelableSuperEventArgs.
·
Use the new variable and call the
CancelSuperCall() method.
Below is an X++ example of subscribing to a lookup event and
canceling the super call.
1
2
3
4
5
6
7
8
9
10
11
|
[FormControlEventHandler(formControlStr(VendCertification,
StateId), FormControlEventType::Lookup)]
public
static void StateId_OnLookup(FormControl sender, FormControlEventArgs e)
{
//
Declare and initialize new variable.
FormControlCancelableSuperEventArgs
formControlCancelSuper = e as FormControlCancelableSuperEventArgs;
//Custom
lookup code can go here.
//
Cancel the super call of lookup control.
formControlCancelSuper.CancelSuperCall();
}
|
No comments:
Post a Comment
if you have any doubts, please tell me