# AX CASCADING

**URL:** <https://www.dynamicsuser.net/t/ax-cascading/54062>\
**Category:** Technical Forum\
**Created:** [July 24, 2014, 9:48am UTC](https://www.dynamicsuser.net/t/ax-cascading/54062 "2014-07-24T09:48:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shinjaKE](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@shinjaKE](https://www.dynamicsuser.net/u/shinjaKE)\
**Post date:** [July 24, 2014, 9:48am UTC](https://www.dynamicsuser.net/t/ax-cascading/54062/1 "2014-07-24T09:48:18Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![RaghavShanbog](https://avatars.discourse-cdn.com/v4/letter/r/7993a0/32.png) [@RaghavShanbog](https://www.dynamicsuser.net/u/RaghavShanbog)\
**Post date:** [July 24, 2014, 1:40pm UTC](https://www.dynamicsuser.net/t/ax-cascading/54062/2 "2014-07-24T13:40:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![shinjaKE](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@shinjaKE](https://www.dynamicsuser.net/u/shinjaKE)\
**Post date:** [July 25, 2014, 6:42am UTC](https://www.dynamicsuser.net/t/ax-cascading/54062/3 "2014-07-25T06:42:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![RaghavShanbog](https://avatars.discourse-cdn.com/v4/letter/r/7993a0/32.png) [@RaghavShanbog](https://www.dynamicsuser.net/u/RaghavShanbog)\
**Post date:** [July 25, 2014, 7:14am UTC](https://www.dynamicsuser.net/t/ax-cascading/54062/4 "2014-07-25T07:14:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![shinjaKE](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@shinjaKE](https://www.dynamicsuser.net/u/shinjaKE)\
**Post date:** [July 25, 2014, 9:10am UTC](https://www.dynamicsuser.net/t/ax-cascading/54062/5 "2014-07-25T09:10:18Z")

</div>

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,
