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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

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

(0) 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.
I have the same question (0)
  • Martin Dráb Profile Picture
    235,243 Most Valuable Professional 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
    26,252 Super User 2025 Season 2 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

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

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 261 Super User 2025 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 253 Most Valuable Professional

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 210 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans