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,124 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,124 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,166 Moderator on at