web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Loop on all controls in a form

(0) ShareShare
ReportReport
Posted on by 140

Hi everybody,

I would like to know if someone ever done such a thing.

My aim is to change "mandatory" property after creation of each control on a form with a parameter table.

If someone have an idea, it would be welcome.

Regards,

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Andrew Xu Profile Picture
    3,877 on at

    Hi deftonesmichael,

    Please check this out,

    microsoft-dynamics-ax-erp.blogspot.com/.../iterate-through-all-controls-of-form.html

  • Verified answer
    Community Member Profile Picture
    on at

    As per my understanding looping through form control to make the control mandatory is not good idea.
    I consider your controls on form are bound to fields in datasource table.
    so you should consider identifying the datasource field and specifying it mandatory.

    Utilize mandatory() method of Datasource field object
    Please find more details in below link
    http://msdn.microsoft.com/en-us/library/aa860145.aspx

    Please verify and update us if this helps you.

  • Verified answer
    deftonesmichael Profile Picture
    140 on at

    Thank you for your answers.

    I follow your idea Nitesh.

       DictTable               dictTable;

       DictField               dictField;

       int                     fldCnt;

       QueryBuildFieldList     qBFL;

       qBFL = salesTable_ds.query().dataSourceTable(tablenum(SalesTable)).fields();

       for (fldCnt = 1; fldCnt <= qBFL.fieldCount() ; fldCnt++)

       {

           dictField = new DictField(tablenum(SalesTable), qBFL.field(fldCnt));      

           if(dictField.name() == "Email")

           {            

               SalesTable_ds.object(qBFL.field(fldCntjavascript:void(0);)).mandatory(true);    

           }                    

       }

    it works perfectly !!

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans