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

Announcements

No record found.

News and Announcements icon
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.

  • Verified answer
    Gunjan Bhattachayya Profile Picture
    35,429 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

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

#1
Martin Dráb Profile Picture

Martin Dráb 523 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 408 Super User 2026 Season 2

#3
CU10121822-0 Profile Picture

CU10121822-0 354

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans