web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Avoid super call for data source lookup reference

(0) ShareShare
ReportReport
Posted on by 1,078

Hi Experts,

I have written a COC for form data source field employee. is there any way i can avoid calling super() using _formReferenceControl ? I tried by using FormDataFieldCancelableSuperEventArgs class but it didnt work.

public Common lookupReference(FormReferenceControl _formReferenceControl)
{
next lookupReference(_formReferenceControl);
return PurchReqLine::lookupRequester(_formReferenceControl);
}

Thanks in advance

I have the same question (0)
  • Verified answer
    WillWU Profile Picture
    22,361 on at
    RE: Avoid super call for data source lookup reference

    Hi Guruprasanna,

    FormControlCancelableSuperEventArgs and FormDataFieldCancelableSuperEventArg can be used in Lookup event.

    For example,the following codes:

    [FormControlEventHandler(formControlStr(WorkOrderTable, WorkOrderLine_JobTypeCopy1), FormControlEventType::Lookup)]
    public static void WorkOrderLine_JobTypeCopy1_OnLookup(FormControl sender, FormControlEventArgs e)
    {
    
    FormRun  formRun  = sender.formRun();
    //canceling super()
    FormControlCancelableSuperEventArgs cancelableArgs = e as FormControlCancelableSuperEventArgs;
    cancelableArgs.CancelSuperCall();
    }

    CoC can't avoid the super() method in lookup/lookupReference.

    Try to use registerOverrideMethod.

    Refer to the codes:

    Dialog dialog = new Dialog("Select user");
    DialogField df = dialog.addField(extendedTypeStr(HcmWorkerRecId),"User");
    df.registerOverrideMethod(methodstr(FormReferenceControl, lookupReference),
    methodstr(YourClass, lookupWorker),
    this);

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 886 User Group Leader

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 870 Super User 2025 Season 2

#3
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 697

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans