Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Renaming all the customer No

Posted on by Microsoft Employee

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

  • Suggested answer
    TharangaC Profile Picture
    TharangaC 23,116 on at
    RE: Renaming all the customer No

    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

  • Verified answer
    4BzSoftware Profile Picture
    4BzSoftware 6,071 on at
    RE: Renaming all the customer No

    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.

  • Verified answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,139 Super User 2024 Season 2 on at
    RE: Renaming all the customer No

    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

  • Suggested answer
    keoma Profile Picture
    keoma 32,675 on at
    RE: Renaming all the customer No

    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, ...)

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans