Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Reset auto-number sequence number in CRM Online

Posted on by Microsoft Employee

Is there a way to reset the auto-generated sequence numbers used to create unique IDs for quotes, accounts, etc.? The official word from Microsoft Dynamics CRM Support is that it cannot be done, and the only way to acquire a "clean slate" is to request an organization reset. For small organizations with a single provisioned environment, how are they to orchestrate a proper SDLC with stages for development, testing, staging, and production? It seems unfeasible to require these orgs to request an org refresh each time they have test data in a developed environment & need to move to production.

*This post is locked for comments

  • ChrisHH Profile Picture
    ChrisHH on at
    RE: Reset auto-number sequence number in CRM Online

    With PowerAutomate and Datavers Connector there is a simple way to reset it to any value.

    Screenshot-2022_2D00_02_2D00_01-at-13.21.53.png

  • Suggested answer
    Kokulan Profile Picture
    Kokulan 18,048 on at
    RE: Reset auto-number sequence number in CRM Online

    Hi

    This is a one off script, you can run from a console app, or linqpad script if you are familiar with or you could even use the XrmToolBox Code now plugin and run this script from there

    Please see below as to how you can run this script using Code Now plugin on Xrm Tool Box

    ScreenClip-_5B00_90_5D00_.png

    4265.ScreenClip-_5B00_87_5D00_.png

    Clear the default code and paste the following

    1512.ScreenClip-_5B00_93_5D00_.png

    public static void CodeNow() { QueryExpression qe = new QueryExpression("organization") { ColumnSet = new ColumnSet(new string[] {"organizationid", "name", "currentkbnumber"}) }; EntityCollection orgs = Service.RetrieveMultiple(qe); if (orgs != null && orgs.Entities.Count == 1) { var org = orgs[0]; var organizationId = (Guid)org["organizationid"]; Entity entOrg = new Entity("organization", organizationId); entOrg["currentkbnumber"] = 1; // This is the value you will be resetting to Service.Update(entOrg); } }
    
    

    And then if you run, the script should execute and perform the update.

    If you have not used XrmToolBox before, please follow the links below

    https://www.youtube.com/watch?v=TSN2oVKnjM0

    You can download the XrmToolBox from : 

    https://xrmtoolbox.com

    And then install the Code Now plugin from Plugin Store

    ScreenClip-_5B00_90_5D00_.png

    7870.ScreenClip-_5B00_91_5D00_.png

  • SudhirPr Profile Picture
    SudhirPr 45 on at
    RE: Reset auto-number sequence number in CRM Online

    Thanks for sharing the 'supported' way of doing this sequence reset. Can you also point out where exactly this code needs to be plugged & run ? Appreciate. Thanks!

  • Suggested answer
    Hayer Profile Picture
    Hayer 802 on at
    RE: Reset auto-number sequence number in CRM Online

    I think I am late to the party but in case anyone still struggling to find an answer, here is the answer: http://hayercrm.blogspot.com/2016/02/how-to-reset-auto-numbering-in-dynamics.html 

  • ScottDurow Profile Picture
    ScottDurow 50,177 on at
    RE: Reset auto-number sequence number in CRM Online

    Hi - the numbering is internal I've not seen anyway of resetting this number for Dynamics CRM Online.

    If you need a mechanism to reset you can use a third party solution such as advcrm2011autonumber.codeplex.com

    Hope this helps,

    Scott

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