Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / Dynamic FormComboBox c...
Finance forum
Suggested answer

Dynamic FormComboBox control added on the form using code lookup not working

Posted on by 3
Hello folks, we have design where we need to add the control on the form dynamically based on the setup. In that I have added the  FormControlComboBox after the super() of Init(). 
also I'm populating the combo box with the values using the FormControlComboBox.item() and .text(). When I execute and see the output of the form I do not see the lookUp working
The lookup icon is shown but neither the values populated nor the lookup itself working. 
 
Alternate solution implemented. - Not working though.
 I have replaced the ComboBox with FormStringControl and used the registerOverRide() method of LookUp() on the form init(). In this case the debugger doesn't hit the registered method if I were to debug the case why the lookup is not working.
 
Question:-
 
Could anyone help me understand why the lookup is not working?
Does the registerOverridemethod will work for dynamically added controls on the form?
Is there any better way to approach this design? 
 
Below the form and the control added on the form
 
Below the code used:-
  • Suggested answer
    CU06090451-0 Profile Picture
    CU06090451-0 3 on at
    Dynamic FormComboBox control added on the form using code lookup not working
    @Waed Ayyad, Thank you for suggesting your valuable input. I have found the root cause of the issue. Where I was incorrectly overriding  the methods(text(), item()) of FormControlComboBox in the while loop. Instead of text and item method I must be using the add() method. After the change I have made I could see the expected behaviour. 
     
    Solution: 
    comboBoxCtrl.add("Test");
     
  • Suggested answer
    Waed Ayyad Profile Picture
    Waed Ayyad 5,483 Super User 2024 Season 2 on at
    Dynamic FormComboBox control added on the form using code lookup not working
    Hi,
     
    Can you show me the whole code for the Lookup of string control?
    You can check the following link Also:
     
    In case you want to have Enum with different values based on logic or condition and you already know all values, you can create Enum with all values and show the elements that you want based on condition as in the following links:
     
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     
  • Komi Siabi Profile Picture
    Komi Siabi 12,606 Most Valuable Professional on at
    Dynamic FormComboBox control added on the form using code lookup not working
    Moved from AX forum.

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

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

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 228,552 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans