Skip to main content

Notifications

Announcements

No record found.

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

How to fill a control value based on the modification of another control?

Posted on by 1,548
Hi,
 
if let's say we have two controls, control1 and control2... how can we fill control2 based on modification of control1?
currently the word /hi/ is not being filled in control2 when i modify control1, why?
[Form]public class Form1 extends FormRun{    [Control(/String/)]    class control1    {        /// <summary>        ///        /// </summary>        /// <returns></returns>        public boolean modified()        {            boolean ret;                    ret = super();            if(ret)            {               Control2.text(/hi/);            }                    return ret;        }    }
 
  • Suggested answer
    Waed Ayyad Profile Picture
    Waed Ayyad 6,347 Super User 2024 Season 2 on at
    How to fill a control value based on the modification of another control?
    Hi 
     
    You Can add your code on form Control (override modified field), or DataSource level by overriding Modified field method, or on Table level. It depends on the logic that you want to apply.
     
    Regards,
    Waed
     
     
  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,235 Most Valuable Professional on at
    How to fill a control value based on the modification of another control?
    Then forget individual controls and focus on data sources.
     
    Also, is the logic specific to this single form or should it happen in all cases? If the latter, don't put it on the form at all - put it on the table itself, such as to modifiedField() method.
  • junior AX Profile Picture
    junior AX 1,548 on at
    How to fill a control value based on the modification of another control?
    Hi Martin,
     
    Yes bound to a datasource and it's the same data source for both
  • Martin Dráb Profile Picture
    Martin Dráb 230,235 Most Valuable Professional on at
    How to fill a control value based on the modification of another control?
    Are the controls bounds to a data source? You code assumes that they aren't - and the assumption may be wrong.
     
    And is it the same data source or two different ones?

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

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 Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans