Skip to main content

Notifications

Dynamics 365 Community / Forums / Human Resources forum / Disable and skip the m...
Human Resources forum
Suggested answer

Disable and skip the mandatory property from the table level field in d365fo

Posted on by 6
Hi ,
 
I am working on HR module where i worked on Loan item equipment form , where i don't need the loan item field because at the place of loan item , i need inventory item id field , but while creating new record on form , it is showing Filed Loan must be filled in .
 
when i am trying to change mandatory properties thru extension , it is not allowing me , 
 
i have written code on form data source level ,but it is not working
 
 public boolean validateWrite()
    {
        boolean         ret                     = next validateWrite();
        FormRun        formRun                  = this.formRun() as FormRun;
        Formdatasource FrmDataSource_ds         = this.formRun().dataSource(formDataSourceStr(HcmPersonLoan,HcmPersonLoan));
        HcmPersonLoan  hcmPersonLoan ;
        hcmPersonLoan = FrmDataSource_ds.cursor();

        if(!hcmPersonLoan.Loan)
        {
            ret = FrmDataSource_ds.object(fieldNum(HcmPersonLoan, Loan)).mandatory(false);
        }
        return ret;
    }
 
 
please look in to this , and provide me the solution.
  • Suggested answer
    Judecarey Profile Picture
    Judecarey 9 on at
    Disable and skip the mandatory property from the table level field in d365fo
    It seems that you are experiencing an issue with the Loan item field in your HR module. You want to replace it with the Inventory item ID field but are unable to change the mandatory properties through extension. You have written code on the form data source level, but it is not working as expected. I would suggest reviewing your code and ensuring that the changes you are trying to make are implemented correctly. Additionally, you may want to check if there are any other dependencies or validations related to the Loan item field that need to be addressed.
  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 228,041 Super User 2024 Season 2 on at
    Disable and skip the mandatory property from the table level field in d365fo
    The table itself requires the field to be filled in. You're not allowed to override it in a form and start creating invalid records.
     
    The table links people and and what was loaned, so these two pieces are information are always needed. Maybe it's not the the right table for your business requirements. But I suggest you respect the data model and use LoanItemId on HcmLoanItem, instead of trying to ignore HcmLoanItem table and move ItemId directly to HcmPersonLoan. Your design would also mean that a loan can't contain more than one item.

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

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

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,246 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,041 Super User 2024 Season 2

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans