Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / addLookupMethod proble...
Finance forum
Answered

addLookupMethod problem X++

Posted on by 65

My custom display method in the extension doesn't work in addLookupMethod.

0028.PNG

2350.PNG

43513.PNG

  • jerrold-verzosa Profile Picture
    jerrold-verzosa 65 on at
    RE: addLookupMethod problem X++

    Good reference for lookup in forms.

    [quote user="Moeen Ahmed Sultan"]

    Hi,

    To create lookup, please follow one of the following article:

    1) http://msdynamics.nevoitech.com/microsoft/how-to-create-lookup-in-form-data-source-field-in-d365fo/ (Recommended)

    2) http://msdynamics.nevoitech.com/microsoft/how-to-create-lookup-in-d365fo-using-x/

    [/quote]
  • Verified answer
    jerrold-verzosa Profile Picture
    jerrold-verzosa 65 on at
    RE: addLookupMethod problem X++

    Changed my approach and used the BudgetCycle method    editCycleStartDate and editCycleEndDate
    pastedimage1568862491562v1.png
    private void calendarYearLookup(FormStringControl _lookup)
        {
            Query query = new Query();
            QueryBuildDataSource qbds;
            SysTableLookup sysTableLookup;

            if(_lookup != null)
            {
                sysTableLookup = SysTableLookup::newParameters(tableNum(BudgetCycle), _lookup);
                
                qbds = query.addDataSource(tableNum(BudgetCycle));

                qbds.addSortField(FieldNum(BudgetCycle, Name),SortOrder::Ascending);

                qbds.fields().addField(fieldNum(BudgetCycle, StartFiscalCalendarPeriod));
                qbds.fields().addField(fieldNum(BudgetCycle, EndFiscalCalendarPeriod));

                sysTableLookup.addLookupField(fieldNum(BudgetCycle, Name), true);
                sysTableLookup.addLookupMethod(tableMethodStr(BudgetCycle, editCycleStartDate));
                sysTableLookup.addLookupMethod(tableMethodStr(BudgetCycle, editCycleEndDate));
                sysTableLookup.parmUseLookupValue(false);

                sysTableLookup.parmQuery(query);
                sysTableLookup.performFormLookup();

            }

    Thanks!

  • Moeen Ahmed Sultan Profile Picture
    Moeen Ahmed Sultan 1,402 on at
    RE: addLookupMethod problem X++

    Hi,

    There are links to GitHub repository. And please verify the answer.

    Regards,

    Moeen Ahmed Sultan

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: addLookupMethod problem X++

    Hello,

    Code looks fine. It should be working fine.

    Could you paste the full code from lookup method.

    Thanks and regards,

    Bharath

  • Suggested answer
    Moeen Ahmed Sultan Profile Picture
    Moeen Ahmed Sultan 1,402 on at
    RE: addLookupMethod problem X++

    Hi,

    To create lookup, please follow one of the following article:

    1) http://msdynamics.nevoitech.com/microsoft/how-to-create-lookup-in-form-data-source-field-in-d365fo/ (Recommended)

    2) http://msdynamics.nevoitech.com/microsoft/how-to-create-lookup-in-d365fo-using-x/

  • Verified answer
    Blue Wang Profile Picture
    Blue Wang on at
    RE: addLookupMethod problem X++

    Hi Jerrold,

    According to your description, it is similar to this thread, you can understand the context.

    [View:https://community.dynamics.com/365/financeandoperations/f/dynamics-365-for-finance-and-operations-forum/287667/addlookupmethod-from-method-in-extension-table-class:750:50]

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,263 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,112 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans