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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Making fields mandatory on DirPartyQuickCreateForm

(0) ShareShare
ReportReport
Posted on by 10

Hi all !

I have a requirement to make the Phone and E-mail field of the DirPartyQuickCreateForm mandatory.

I have tried this using these methods so far but no success:

  • OnValidatingWrite event on Logistics Electronic Address datasource
  • COC on CloseOk method of the form.

Please help me to resolve this.

I have the same question (0)
  • Verified answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Ax-User,

    You could try creating a CoC on the form init method and make these fields mandatory on the form. However the data sources have validateWrite methods overridden to return true. So, we can create validation methods for these two fields in the same extension class.

    [ExtensionOf(formStr(DirPartyQuickCreateForm))]
    final class DirPartyQuickCreateForm_Extension
    {
        public void init()
        {
            next init();
    
            
            LogisticsElectronicAddressBusinessPhone_ds.object(fieldNum(LogisticsElectronicAddress, Locator)).mandatory(true);
            LogisticsElectronicAddressEmail_ds.object(fieldNum(LogisticsElectronicAddress, Locator)).mandatory(true);
        }
    
        public boolean checkPhone()
        {
            boolean ret = true; 
    
            if (!LogisticsElectronicAddressBusinessPhone.Locator)
            {
                ret = checkFailed("Phone must be filled in.");
            }
    
            return ret;
        }
    
        public boolean checkEmail()
        {
            boolean ret = true;
    
            if (!LogisticsElectronicAddressEmail.Locator)
            {
                ret = checkFailed("Email must be filled in.");
            }
    
            return ret;
        }
    
    }

    You can then create a CoC on validateWrite method of DirPartyEntity data source to call the methods written earlier.

    [ExtensionOf(formDataSourceStr(DirPartyQuickCreateForm, DirPartyEntity))]
    final class DirPartyQuickCreateForm_DirPartyEntity_Extension
    {
        public boolean validateWrite()
        {
            boolean ret = next validateWrite();
    
            ret = ret && element.checkPhone() && element.checkEmail();
    
            return ret;
        }
    
    }

  • Ax-User Profile Picture
    10 on at

    Hi Gunjan !

    Thank you . I tried this and it is working now.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 659 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 533 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 289 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans