Skip to main content

Notifications

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

Make field mandatory based on some conditions

(0) ShareShare
ReportReport
Posted on by 53
Hi
 
I want to make a field mandatory based on some conditions in ProjTable.
I have added field in ProjTable Extension ,now I want to make this field mandatory based on the value of some other field in same table.
 
Please suggest.
 
Regards
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,587 Super User 2024 Season 1 on at
    Make field mandatory based on some conditions
    As Girish and Martin suggested, you can either do a COC or event handler for that object. You can extend the validatewrite() of table and based on condition, if that field is empty, you can return warning.
  • Martin Dráb Profile Picture
    Martin Dráb 230,853 Most Valuable Professional on at
    Make field mandatory based on some conditions
    You can't change the form, but you can extend it. You can either create a CoC (Chain of Command) extension class or an event handler.
  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    Make field mandatory based on some conditions
    Yes, I understood it's a standard form. Thats why I asked you to write OnActivated event handler at DataSource level.
    Refer to the below. blog.
     
    In the below blog they have mentioned to add it in ValidateWrite method at form DataSource level.
    So instead of active method you can add it on the OnValidatingWrite event handler of form DataSource level.
     
    Thanks,
    Girish S.
     
     
  • rsingh62 Profile Picture
    rsingh62 53 on at
    Make field mandatory based on some conditions
    Hi Girish
    Thanks for your response.
    Proj Table in a system form. Can't override method in this form.
    Could you please suggest me how to implement the above method that u have mentioned ?
     
     
  • Suggested answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    Make field mandatory based on some conditions
    Hi rsingh,
     
    You can add your logic on the onActivated method at the DataSource level. 
    You can do it like below.
    sender.object(fieldnum(TableName, FieldName)).mandatory(true);
     
    Thanks,
    Girish S.

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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,996 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,853 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans