Skip to main content

Notifications

Microsoft Dynamics AX forum
Suggested answer

Make a field mandatory. when any field is modified in form

editSubscribe (1) ShareShare
ReportReport
Posted on by 2
Hi,

I have a form that contains header and lines in toolbar and list pattern. In header I have a field /Reason for modification/. The requirement is to make this field mandatory when any modifications are made on header or line level.

can someone point me to right direction.
  • Martin Dráb Profile Picture
    Martin Dráb 223,096 Super User on at
    Make a field mandatory. when any field is modified in form
    If your intention is that a reason must be provided when you change a line, your design is wrong. That a field in a header is made mandatory is irrelevant when you're saving a line (= a different table). You'll need to design it in a different way.
     
    If a line record can't be saved without the reason, you should show a dialog before saving the line, e.g. in validateWrite() of the line data source.
     
    Also, consider whether a mere field is sufficient, because it can hold only one reason, for the latest change. Reasons of the previous change would be overwritten every time.
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    Mohamed Amine Mahmoudi 4,246 User Group Leader on at
    Make a field mandatory. when any field is modified in form
    Hi,
     
    you must use this code based condition :
    if(...)
    {
       {{YourTable}}_ds.object(fieldNum({{YourTable}}, {{YourField}})).mandatory(true);
    }
    else
    {
       {{YourTable}}_ds.object(fieldNum({{YourTable}}, {{YourField}})).mandatory(false);
    }
    Best regards,
    Mohamed Amine MAHMOUDI

Helpful resources

Quick Links

Take the Community feedback survey!

Answer this brief 15-question survey about your Community experience…

Demystifying Copilot: Service Edition with Sundar Raghavan

Sundar answers more questions about Copilot for Service...

Dynamics 365 Business Central vs Finance and SCM

Take a look at the key differences between Business Central and…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,324 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 223,096 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,140

Featured topics

Product updates

Dynamics 365 release plans