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;
}

  • Suggested answer
    nmaenpaa Profile Picture
    101,156 Moderator on at
    RE: How to stop some functionality in Standard Code in Ax

    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.

  • Martin Dráb Profile Picture
    231,983 Most Valuable Professional on at
    RE: How to stop some functionality in Standard Code in Ax

    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.

  • Martin Dráb Profile Picture
    231,983 Most Valuable Professional on at
    RE: How to stop some functionality in Standard Code in Ax

    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).

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,278 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,983 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans