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, ...
Suggested Answer

How to stop some functionality in Standard Code in Ax

(0) ShareShare
ReportReport
Posted on by 148

below code is the standard code in CustTable , few lines I need not to required to execute(green color lines). how I can do that?

boolean validateDelete()
{
boolean ret;
CustTable custTable;
SalesTable salesTable;

ret = super();

if (this.AccountNum)
{
select firstonly RecId from custTable
where custTable.InvoiceAccount == this.AccountNum;

if (custTable.RecId)
{
ret = checkFailed("@SYS67133");
}

select firstonly RecId from salesTable
where salesTable.InvoiceAccount == this.AccountNum;

if (salesTable.RecId)
{
ret = checkFailed(strFmt("@SYS75284", tablePName(SalesTable)));
}
}

if (ret)
{
ret = CustVendNetAgreementRelationship::validatePartyAssociationNotInCustVendNetAgreementRelationship(this);
}

if (ret && this.CustVendTable::isRelatedToIncompleteWorkflowWorkItems())
{
ret = checkFailed("@AccountsReceivable:CustomerDeletionWorkflowWorkItemError");
}

if (ret && this.isActiveOnCustHierarchyNode())
{
ret = checkFailed("@CustHierarchy:CustDeleteErrorMessage");
}

return ret;
}

I have the same question (0)
  • Martin Dráb Profile Picture
    239,364 Most Valuable Professional on at

    Please use Insert > Insert Code (in the rich formatting view) to paste source code. It preserves line indentation, which makes code much easier to read.

    boolean validateDelete()
    {
    	boolean ret;
    	CustTable custTable;
    	SalesTable salesTable;
    
    	ret = super();
    
    	if (this.AccountNum)
    	{
    		select firstonly RecId from custTable
    			where custTable.InvoiceAccount == this.AccountNum;
    
    		if (custTable.RecId)
    		{
    			ret = checkFailed("@SYS67133");
    		}
    
    		select firstonly RecId from salesTable
    			where salesTable.InvoiceAccount == this.AccountNum;
    
    		if (salesTable.RecId)
    		{
    			ret = checkFailed(strFmt("@SYS75284", tablePName(SalesTable)));
    		}
    	}
    
    	if (ret)
    	{
    		ret = CustVendNetAgreementRelationship::validatePartyAssociationNotInCustVendNetAgreementRelationship(this);
    	}
    
    	if (ret && this.CustVendTable::isRelatedToIncompleteWorkflowWorkItems())
    	{
    		ret = checkFailed("@AccountsReceivable:CustomerDeletionWorkflowWorkItemError");
    	}
    
    	if (ret && this.isActiveOnCustHierarchyNode())
    	{
    		ret = checkFailed("@CustHierarchy:CustDeleteErrorMessage");
    	}
    
    	return ret;
    }

    Also, please use Development / Customization / SDK category for questions related to development (I've already changed that for you).

  • Martin Dráb Profile Picture
    239,364 Most Valuable Professional on at

    Are you sure that it's a good idea? If you delete a customer A that is used as an invoice account of customer B, you'll end up with inconsistent database and customer B will be unusable. The validation looks important to me.

  • Suggested answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    Hi Prasanth123,

    in AX you can change the code any way you like. So just open this class in code editor and remove the code that you don't like. Of course removing this particular code will lead to issues, but you're responsible of the changes you implement. Perhaps you want to check with your team and with your customer one more time if you really want to break this standard functionality.

    Also, you can't upgrade such code to D365.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 694

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 646 Super User 2026 Season 1

#3
CP04-islander Profile Picture

CP04-islander 337

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans