Wednesday, April 7, 2021

Variant Lookup for Master Item In d365Fo

 

Variant Lookup for Item In d365Fo.


======================customized from(over ride method) =====================

    void lookup()

    {

        FormRun formRun = ClassFactory.formRunClass(new Args(formstr(RetailVariantLookup)));


        formRun.args().parm(itemId);

        formRun.args().caller(fieldItemId.control());//_formControl);

        formRun.init();


        //_formControl

        fieldItemId.control().performFormLookup(formRun);

    }


========================Standard form(using Events)=========================



    [FormControlEventHandler(formControlStr(SalesTable, RetailVariantId), FormControlEventType::Lookup)]

    public static void RetailVariantId_OnLookup(FormControl sender, FormControlEventArgs e)

    {

        FormControlCancelableSuperEventArgs     formControlCancelSuper  = e as FormControlCancelableSuperEventArgs;

        FormRun                                 formRun                 = ClassFactory.formRunClass(new Args(formstr(RetailVariantLookup)));

        FormStringControl                       itemId                  = sender.formRun().design().controlName(formControlStr(SalesTable, ItemCode));

        FormStringControl                       retailVariantId         = sender.formRun().design().controlName(formControlStr(SalesTable, RetailVariantId));

        ;


        formControlCancelSuper.CancelSuperCall();


        formRun.args().parm(itemId.valueStr());

        formRun.args().caller(retailVariantId);//_formControl);

        formRun.init();


        //_formControl

        retailVariantId.performFormLookup(formRun);

    }


Keep Daxing!!

No comments:

Post a Comment