AX CASCADING

Hello all,

I am new in AX having come from Dynamics NAV. Now I have made some tables which have a relation to accountnum in the CustTable. Now my question is, when I change the AccountNum in the CustTable, I want the new accountnum change to be cascaded to all the realted tables but it is not happening. In NAV, this used to be automatic. Is there a property I need to enable for this to happen?

PLEASE HELP!

Hi,

You can do it in two ways in AX,

  1. Open Accounts receivable | Common | Customers | All customers and find the
    account that has to be renamed. Righclick record info, press the Rename Button and put the value that you want. AX renames the primary key and all the relations.

  2. Through the code when you want to apply for more records,

static void CustAccountRename(Args args)
{
CustTable custTable;
select firstOnly custTable
where custTable.AccountNum == ‘1103’;
if (custTable.RecId)
{
custTable.AccountNum = '1103
’;
custTable.renamePrimaryKey();
}
}

I hope this is what you wanted to do.

Regards,

Raghav.

Thanks a lot man. This worked. It was exactly what I was looking for. You have an email I can use to ask you any other arising questions? Thanks

Hi,

I suggest to use the forum, as others in the forum will also get benefited from the questions and suggested solutions. You can also get multiple or better solutions from the experts if you use the blog.

Regards,

Raghav.

Cheers.

Now can I ask which class controls this as I want to limit the changing of this primary key to only customers who do not have any posted records.

Thanks,