Skip to main content

Notifications

Announcements

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,025 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,220 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

New Blog Features Released!

Check out the new community blog features for viewers and authors…

Demystifying Copilot with Sundar Raghavan

Sundar explains how Copilot for Service is meant to function separately...

Business Process Guidance Badges and New…

The Microsoft Success by Design is the framework for implementing Dynamics 365…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 223,025 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,140

Featured topics

Product updates

Dynamics 365 release plans