Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

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

(1) ShareShare
ReportReport
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 6,360 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,711 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

News and Announcements

Announcing Category Subscriptions!

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,359 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans