Sunday, 20 February 2022

OnLookup FormEventHandler in D365 F&O

 class DDDInventJournalNameFormEventHandler

{

    [FormControlEventHandler(formControlStr(InventJournalName, DDDBudget_DDDDefaultGeneralJournal), FormControlEventType::Lookup),

    SuppressBPWarning('BPParameterNotUsed', 'False positive')]

    public static void DDDBudget_DDDDefaultGeneralJournal_OnLookup(FormControl sender, FormControlEventArgs e)

    {

        Query                   query = new Query();

        QueryBuildDataSource    queryBuildDataSource;

        SysTableLookup          sysTableLookup;

        sysTableLookup = SysTableLookup::newParameters(tableNum(LedgerJournalName), sender);

        queryBuildDataSource = query.addDataSource(tableNum(LedgerJournalName));

        queryBuildDataSource.addRange(fieldNum(LedgerJournalName, JournalType)).value(strFmt('%1',any2int(LedgerJournalType::Daily)));

        queryBuildDataSource.addRange(fieldNum(LedgerJournalName, DDDProcessBudget)).value(strFmt('%1',any2int(NoYes::Yes)));

        sysTableLookup.addLookupField(fieldNum(LedgerJournalName, JournalName), true);

        sysTableLookup.addLookupField(fieldNum(LedgerJournalName, Name));

        sysTableLookup.parmQuery(query);

        sysTableLookup.performFormLookup();

    }

}

No comments:

Post a Comment

DefaultDimension in d365 FO X++

 Navigate to PurchTable methods you can find with DefaultDimension this.DefaultDimension = this.mergeDimension(this.getDefaultDimension(),th...