Skip to main content

Notifications

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

Add a lookup field

(0) ShareShare
ReportReport
Posted on by 35

Hi D365 folks. 

I am trying to add additional field as a lookup from customer account lookup when creating  a new sales order. Currently, when typing something from the customer account field without hitting the arrow for dropdown and it can't find a specific customer account based on the keyword, it will proceed on searching for the customer name. 

pastedimage1685635753020v3.png

  

Now, we need to add a new field so that when the keyword entered can't be found from the customer account and customer name, it should be able to search for another field which in my case, the search name. I already checked everything I think, but no luck. I can't use lookup CoC or event handler since lookup comes first before the modify event. Any who knows how to attain this feature? Which class or form setup to check or customize?

  • LOE Profile Picture
    LOE 35 on at
    RE: Add a lookup field

    Name alias is already on the CustTableLookup form. I tried moving it right below the the AccountNum, still not working. I'll tell the users. Thanks a lot, Girish!

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Add a lookup field

    I think this cannot be possible. Have you tried adding the NameAlias to the lookup field and check?

    Thanks,

    Girish S.

  • LOE Profile Picture
    LOE 35 on at
    RE: Add a lookup field

    Hi Girish,

    I wanted to add NameAlias from DirPartyTable. Are you referring to the first index of the CustTable and DirPartyTable? Only these two index fields will appear on the lookup?

  • Verified answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Add a lookup field

    Yeah, now I understood what you are asking.

    I don't think this is achievable. You can either filter by customer account or customer name - You cannot add third one. In CustTable you can select either by index field CustAccount or Name - You cannot add fields other than that I guess.

    Can I know which field you are trying to add?

    Thanks,

    Girish S.

  • LOE Profile Picture
    LOE 35 on at
    RE: Add a lookup field

    Hi Girish,

    When entering a text from the customer account account field when creating a new sales order for instance without hitting the v icon to perform a lookup, for example the "test2" on my second screenshot, the lookup will automatically appear and search for the customer account. Then if there is no "test2" from the customer account, it will now then proceed to look for "test2" from the customer name (second screenshot). Now we need to add additional logic to look for a third field if there is no "test2" from customer account and name. Maybe search name. I can't find which form settings or code the logic takes place for me to add my logic. Hoping that you can help me find which approach to take. Thanks!

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Add a lookup field

    I am not able to understand the issue. Lookup method won't give the value entered in the lookup control. In fact, as you said it's too early to get the value of lookup control in COC or event handler.

    Can you elaborate more please?

    Thanks,

    Girish S.

  • LOE Profile Picture
    LOE 35 on at
    RE: Add a lookup field

    Thanks, Girish! I already tried that approach. The problem is, lookup event comes first before the modify/modified event. So when I'm doing CoC or event handler on the lookup, I don't have the latest value input from the customer account field yet. Example, if I write "Test" and do my logic in the lookup, there will be no value on that field yet and it will show empty ("") string instead of "Test" which is the desired value from the user. I duplicated the CustTableLookup and assigned it to the CustAccount EDT I extended and play from there, but I can't see any lead.

  • Suggested answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Add a lookup field

    Hi LexJann,

    You need to add Lookup event handler and cancel the standard lookup by cancelling the super call.

    Thanks,

    Girish S.

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

Announcing Our 2025 Season 1 Super Users!

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

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,965 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,836 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans