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 :
Microsoft Dynamics AX (Archived)

Rename Journal by Code X++

(0) ShareShare
ReportReport
Posted on by

hello,

Is it possible to rename a general journal in D365FO using X++ ?!

this is the scenario:

1) Parse list of Journal

2) Get the one named "TEST"

3) Modify it's name to "TEST 1"

Please check attached picture:

rename_5F00_Journal.png

Thanks in Advance,

*This post is locked for comments

I have the same question (0)
  • Sohaib Cheema Profile Picture
    49,677 Super User 2026 Season 1 on at

    your journal name is derived from journal type. you need to go to Main Table from here and see whether it allows you to use rename..? If this is based on primary key, it should allow you to do so.

  • Community Member Profile Picture
    on at

    Ok thanks, how can I parse list of created journals?

    and rename it?!

  • Sohaib Cheema Profile Picture
    49,677 Super User 2026 Season 1 on at

    I would appreciate if you may explain the phase 'Parse' here in any context.

  • Community Member Profile Picture
    on at

    Just for your information, i'm a new 365 Developer.

    I mean by Parse: Get list of all Journal.

  • Sohaib Cheema Profile Picture
    49,677 Super User 2026 Season 1 on at

    To get list of all journals you can use while select statement

    LedgerJournalTable LedgerJournalTable;

    ;

    While select LedgerJournalTable

    where LedgerJournalTable.JournalName == 'ABC'

    {

    //Do anything

    }

    if you want to update existing records of  LedgerJournalTable  you have to update existing records. for new records change it from journal main form (from where this name is derived)

    PS: If you are new to AX, don't worry, just let us know what you want to do. don't share any code, just tell us your business requirement considering us an end user.

  • Community Member Profile Picture
    on at

    Ok Sohaib, thanks for your help.

    I've created a new Model called UpdateJournal (extension not overlaying).

    Then i create a runnable class just to test your code.

    I've got this error:

    "Error: he name 'LedgerJournalNameId' does not denote a class, a table, or an extended data type. UpdateJournal (USR) [UpdateJournal]"

  • Community Member Profile Picture
    on at

    Hello Sukrut,

    I've check it, references are already selected in my model:

    I think i've another problem...

    packages.png

  • Grzegorz Skrzypczyk Profile Picture
    225 on at

    Ramzi - are you developing this for the sake of learning or are you attempting to fix something/address a business requirement?

    I am interested why you would want to mass change the journal numbers?  

  • Grzegorz Skrzypczyk Profile Picture
    225 on at

    Here is an example of a job which allows you to rename all unposted journals. The job adds the suffix '_NEW' to the journal number. Be careful what you are doing since for example modifying posted journals may be regarded as a serious fail of data integrity policy.

    static void Job1(Args _args)
    {
        LedgerJournalTable ljt;
        ;
       
        while select ljt where ljt.Posted==NoYes::No
        {
                ljt.JournalNum = strFmt('%1_NEW',ljt.JournalNum);
            ljt.renamePrimaryKey();
        }     
    }

     

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#2
Henrik Nordlöf Profile Picture

Henrik Nordlöf 2 User Group Leader

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans