Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / Lookup validation in X++
Finance forum
Suggested answer

Lookup validation in X++

Posted on by 30

Hi all,

I have a checkbox and a lookup field, when the checkbox is yes, the user is not allowed to type in the lookup field directly (like entering the data manually in the field) instead they should choose the data from lookup and if they typed it manually it needs to throw error.

how to do in X++ ?

Thanks

  • nmaenpaa Profile Picture
    nmaenpaa 101,148 on at
    RE: Lookup validation in X++

    Hi WaytoD365FO,

    unfortunately I don't understand your latest message. Could you try to describe your question in a clearer way? Thanks!

  • WaytoD365FO Profile Picture
    WaytoD365FO 30 on at
    RE: Lookup validation in X++

    Thanks for your replay to all,

    sorry for delay replay.... give us a your solution is that only for two status based not a all lookup and

    i give it to "Lookup only property"  its an impact all lookup what could be causes and resolution ?

  • Martin Dráb Profile Picture
    Martin Dráb 225,549 Super User on at
    RE: Lookup validation in X++

    A lookup form is just an assistance for users who don't know the value to use. But if they want to paste a value copied from another place, or even type it manually, they should be able to do it. Another common use case is typing just a part of value and then opening a lookup form with a filtered list of values.

    Your design would prevent all these things, making your system much less useful.

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 287,914 Super User on at
    RE: Lookup validation in X++

    Hi WaytoD365FO,

    For what reason do you have this requirement? Why should a person choose from the lookup if typing could be in some cases be done quicker? If there is a table relation, there is a default validation if the value exists anyway.

    Blocking the lookup control for manual entry, but allowing the lookup is not possible unless you create a separate button for the lookup.

  • Gunjan Bhattachayya Profile Picture
    Gunjan Bhattachayya 35,417 on at
    RE: Lookup validation in X++

    Hi WayToD365FO,

    If you have a lookup field, you will always need to choose values from the lookup values. Correct? I would think that this field is linked to a master table and the values selected in the field would be validated.

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,148 on at
    RE: Lookup validation in X++

    Just put your code in validateField() or validateWrite() method of the table.

    Whether the user selected "foo" from the lookup or typed "foo" should not make a difference and you should not try to block one of them.

  • Suggested answer
    mhdshb1 Profile Picture
    mhdshb1 1,250 on at
    RE: Lookup validation in X++

    Hi

    Why don't you have one checkbox field , one Lookup field (reference group), and one textbox.

    Based on the checkbox you disable and hide the control you want.

    Regards,

    M

  • Suggested answer
    vinitgoyal2005 Profile Picture
    vinitgoyal2005 6,326 on at
    RE: Lookup validation in X++

    Hi,

    What are you trying to achieve here? You should not stop manual entry like that, I am assuming what you need is to validate if the value is correct which needs to be done in the Validate method and not lookup.

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,914 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,549 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans