Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

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

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

  • Blue Wang Profile Picture
    Blue Wang on at
    RE: How can we use List, Map or Container in D365 for the custom Values of LookUp.

    Hi Bilal,

    Override your control's lookup().

  • bilal170795 Profile Picture
    bilal170795 185 on at
    RE: How can we use List, Map or Container in D365 for the custom Values of LookUp.

    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]
  • bilal170795 Profile Picture
    bilal170795 185 on at
    RE: How can we use List, Map or Container in D365 for the custom Values of LookUp.

    Thanks, Sergei

  • Blue Wang Profile Picture
    Blue Wang on at
    RE: How can we use List, Map or Container in D365 for the custom Values of LookUp.

    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

  • Verified answer
    Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,089 on at
    RE: How can we use List, Map or Container in D365 for the custom Values of LookUp.

    Hi,

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

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 290,902 Super User 2024 Season 2 on at
    RE: How can we use List, Map or Container in D365 for the custom Values of LookUp.

    Hi Bilal,

    Have you considered creating a temporary table; then fill this table with the values dynamically and then use it for the 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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

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

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 229,297 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans