Skip to main content

Notifications

Dynamics 365 general forum

Lookup onchange doesn't work as expected

Posted on by 509

I'm trying to trigger an onchange event (the one in the field properties, events).

On change for the lookup works for another field I'm changing (it switches between two options of an option set based on it's result).

The same onchange event also works for other fields

  • Lee-Martin Profile Picture
    Lee-Martin 509 on at
    RE: Lookup onchange doesn't work as expected

    Thank you but as stated the code is not the issue as it is working perfectly when triggered by a different field. 

    The onchange is exactly the same for the lookup as it is for the textfield which is working as expected.

    What i need to know is why would the onchange not be working for the lookup when it is working for the textfield.

    I'm still not back at my work machine, so cannot share anything yet, and once again the code is not the issue it's the triggering of the onchange.

  • LeoAlt Profile Picture
    LeoAlt 16,329 on at
    RE: Lookup onchange doesn't work as expected

    Hi partner,

    I suggest that you could use F12 to debug your code step by step to find out the reason.

    If you mean the same function could work in other fields' onchange event but not work in the lookup field, you need to make sure if the code has been trigged when you update the field.

    And if you mean you want to change your lookup filed value when changing an option set field, you need to catach the correct field name of lookup field, not dispaly name.

    1856.community112.png

    BTW, could you kindly share your code to us so that we could help you better?

    Hope it helps.

    Best Regards,

    Leo

  • Lee-Martin Profile Picture
    Lee-Martin 509 on at
    RE: Lookup onchange doesn't work as expected

    I'll post the code when I get back to it.

    But I'm not sure how it would be failing if it was working when it is triggered perfectly elsewhere (from an onchange to a text field)

  • Suggested answer
    Adrian Begovich Profile Picture
    Adrian Begovich 21,009 Super User 2024 Season 2 on at
    RE: Lookup onchange doesn't work as expected

    Hi Lee-Martin,

    Can you post your logic and a screenshot of your OnChange event? It is possible that you have made a typo somewhere. The next step is to debug your logic.

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 Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

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... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans