how to make a field mandatory in Table D365

 *** To make a field mandatory in a Table we have to override validateWrite() method


Example:


 public boolean validateWrite()

    {

        boolean ret;


        if (!this.Dept_Name)

       ret = checkfailed("Dept Name must be filled");

    

        return ret;

    }



*** To make a field mandatory in a Datasource we have to use ValidateWrite method on the DataSource of the table.


public boolean  validateWrite()

    {

        boolean ret1;

        ret1= next validateWrite();


        if (!this.InventSiteId )

        {

                    ret1 = checkfailed("Site must be filled");

        }

       

      else  if (!this.InventLocationId  )

        {

            ret1 = checkfailed("Warehouse must be filled");

        }



        return ret1;

    }

Comments

Popular posts from this blog

How to Create a wizard in x++ d365

how to post trade agreement journals automatically using x++ code

X++ code to CREATE AND POST A TRADE AGREEMENT IN MICROSOFT DYNAMICS 365 in D365 F & O