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

Bypass Validate Table method in X++ in D365FO

(0) ShareShare
ReportReport
Posted on by 110

Hello,

I need to bypass or comment a part of a code in a table method. If I use COC I will have to call this method in the "next()" statement and the validation will occur.

What I need to do is to remove this validation. Below is the code that I am working on. I want to comment the highlighted line in yellow from the method PayrollEarningStatementLine.validatePosition(...):

public boolean validatePosition(HcmPositionRecId _positionRecId = this.Position, boolean _showError = true)
{
PayrollEarningStatement earningStatement = this.payrollEarningStatement();
boolean ret = true;

if ((earningStatement.AutoGeneratedSalary == PayrollAutoGenerateSalary::Active
&& PayrollPositionDetails::findByPosition(_positionRecId).AutoGenerateSalary == NoYes::Yes)
&& !PayrollPositionWorkerDefaultTaxRgn::existByWorkerPosition(_positionRecId, earningStatement.Worker))
{
if (_showError)
{
ret = checkFailed("@Payroll:TheTaxRegionIsRequiredToGenerateTheSalaryEnterADefaultTaxReg");
}
else
{
ret = false;
}
}

}

Any solution please?

I have the same question (0)
  • Blue Wang Profile Picture
    on at

    Hi White,

    Please check this thread:

    community.dynamics.com/.../coc---jumpref-on-formdatasource-field---skip-standard-code

  • Verified answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi,

    If it's the only validation in this method you can bypass the check with CoC method like:

    {
        boolean ret = next validatePosition(_positionRecId, false);
    
        ret = true;
    
        return ret;
    }
    

    But I'm not sure if it's fine to bypass check from a functional point of view.

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 451 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans