web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Renaming all the customer No

(0) ShareShare
ReportReport
Posted on by

My customers no are from 1..50000 in the customer list, how can I add "C" infront of 1 for the exisiting customerrecords up to 50000. I want to do it programmatically by renaming it, the reason, we are merging with the other systems. After renaming the  customer no, looks like C1,C2,C3,..C50000. Pls suggest to do it in one go..

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    keoma Profile Picture
    32,729 on at

    it's done by c/al command RENAME.

    msdn.microsoft.com/.../dd355313.aspx

    sample code for one record:

    customer.GET('10000');
    customer.RENAME('C10000');

    place the code in a loop (repeat until, while do end, ...)

  • Verified answer
    Mohana Yadav Profile Picture
    60,993 Super User 2025 Season 2 on at

    Cust.RESET;

    IF Cust.FINDSET THEN

    REPEAT

     Cust2 := Cust;

     Cust2.Rename('C' + Cust."No.");

    UNTIL Cust.NEXT = 0;

    Please try it in Test database first after taking backup

  • Verified answer
    4BzSoftware Profile Picture
    6,073 on at

    Hi Navbsa,

    You can use report with a Customer DataItem, and rename Customer No. in OnAfterGetRecord trigger:

    IF (COPYSTR("No.", 1, 1) <> 'C') THEN BEGIN

      lRec_Customer.GET("No.");

      lRec_Customer.RENAME('C' + "No.");

    END;

    lRec_Customer is a local variable (Customer Record) of OnAfterGetRecord function.

    Using report filter, you can process group of customers. In addition, you can set report as ProcessingOnly to increase speed.

  • Suggested answer
    Tharanga Chandrasekara Profile Picture
    23,118 on at

    This can be possible in NAV.

    Easiest way is to use a process only report to do this so that you do not want to use any repeat commands or do not have to worry about other issues.

    Create a new report and in the report properties set it to Process Only to true.

    Make the report data item as Customer (18)

    And in the body of the report write the following code

    Customer.RENAME('C' + Customer."No.");

     

    This will modify the records without any problem.

    msdn.microsoft.com/.../dd355313.aspx

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans