Ledger Account re-organizing

Hi, we currently think about re-organizing / renaming / re-structuring our “ledger Account numbers”. Does anyone have a cool trick to re-name them?.. guess just “right click” “record info” then rename won’t do it… running Ax. 2.5 / SP2 THX Pirmin

Try this: LedgerTable ledgTable = LedgerTable::find('123456'); ; if (!ledgTable) throw error('Record not found.'); ttsbegin; ledgTable.AccountNum = '0123456'; ledgTable.renamePrimaryKey(); ttscommit; As you have several records to rename you will probably use a “while-select” statement.

Hi, well guess you script only renames in the ledgertable the accounts… but we do need to update all the referenced fields… / tables … Pirmin

Not true; the rename-command will also change all related fields in other tables. Eg field LedgerTrans.AccountNum extends EDT LedgerAccount which relates to LedgerTable.AccountNum - so, LedgerTrans’es will be changed as well. Try it…