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, ...
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
    237,965 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
    237,965 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,162 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

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