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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

How can we use List, Map or Container in D365 for the custom Values of LookUp.

(5) ShareShare
ReportReport
Posted on by 185

I want to use the custom values for lookup, not want to make the table. How can I achieve this through Coding? I have tried the following code but it's quite old and not working in D365. Actually, there is no method such as SysLookup::lookupList().  

public void lookup()
{
Counter yearCount;
List valueList = new List(Types::String);

for (yearCount = 0; yearCount < 5; yearCount++)
{
valueList.addEnd(strFmt("Year %1", year(SystemDateGet()) - yearCount));
}

SysLookup::lookupList(this, valueList, "List of years");
}

*This post is locked for comments

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    300,911 Super User 2025 Season 2 on at

    Hi Bilal,

    Have you considered creating a temporary table; then fill this table with the values dynamically and then use it for the lookup?

  • Verified answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi,

    Check class SysPickList and especially how it's used in DirPartyLookupFormEventHandler_CopyCustVend.CopyCustFrom_OnLookup method.  

  • Blue Wang Profile Picture
    on at

    Hi Bilal,

    Are you looking for a non-database lookup?

    You can check Global :: Picklist () if it's meet your needs.

    A simple example:

    Map lookupmap = new   Map(Types::Integer, Types::String);
    
    lookupmap.insert(1,"First");
    lookupmap.insert(2,"Second");
    lookupmap.insert(3,"Third");
    
    Global::picklist(lookupmap);

    08020.PNG

  • bilal170795 Profile Picture
    185 on at

    Thanks, Sergei

  • bilal170795 Profile Picture
    185 on at

    Hi Blue,

    where I will place this piece of code? because i tried an example like that in the event handler it didn't work.

    [quote user="Blue Wang"]

    Hi Bilal,

    Are you looking for a non-database lookup?

    You can check Global :: Picklist () if it's meet your needs.

    A simple example:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    Map lookupmap = new Map(Types::Integer, Types::String);
    lookupmap.insert(1,"First");
    lookupmap.insert(2,"Second");
    lookupmap.insert(3,"Third");
    Global::picklist(lookupmap);
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    08020.PNG

    [/quote]
  • Blue Wang Profile Picture
    on at

    Hi Bilal,

    Override your control's lookup().

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 660 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 307 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans