Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Auto-Numbering Account Entities on Import

Posted on by Microsoft Employee

Is there a way to have auto-numbering for the Account entity while using the standard import tool? I currently have a plugin to do this, but as you can see from the code below, it gets VERY inefficient as the number of accounts increases. What it's basically doing is searching through all the accounts to find the maximum number and incrementing it by 1 - the problem is that it's searching through the entire list after every new account is added.

var maxNumber = 1;
foreach(var account in accounts)
{
   int j;
   if(int.TryParse(account.AccountNumber, out j))
   {
      if(maxNumber < j)
      {
         maxNumber = j;
      }
   }
}
Target.AccountNumber = (maxNumber + 1).ToString();
ArsOrganizationContext.SaveChanges();

I see that there are paid versions available but I was looking for non-paid solutions. Currently using Dynamics Online 2016 Update 1. 

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Auto-Numbering Account Entities on Import

    Figured it out. For those who would like to know, all you need to do is go to Settings -> Counter Configurations. From there, you create a new counter by indicating which entity, which field name, and then setting the parameters for the counter. Very straightforward.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Auto-Numbering Account Entities on Import

    Thank you for your tip Raz. I have installed the solution but there does not seem to be any documentation on how to use it. For example, I have an Account number attribute for my Account entity - I would like this to be autonumbered but I do not know how to configure this.

  • Suggested answer
    razdynamics Profile Picture
    razdynamics 17,304 User Group Leader on at
    RE: Auto-Numbering Account Entities on Import

    Hi Brian, the zip is a solution file which you import into crm, I think you may have extracted it by mistake. If you have any issues I can send you my version of the autonumber solution.

    Best Wishes, Raz

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Auto-Numbering Account Entities on Import

    Trying to download the Counter in the codeplex link but not quite sure how to install/implement it. There are three folders, "PluginAssemblies", "WebResources", "Workflows". What do I do with these?

  • Verified answer
    PS Profile Picture
    PS 23,577 on at
    RE: Auto-Numbering Account Entities on Import

    Go to the following link and download the solution, install it in CRM and you are good to go: crm2015autonumber.codeplex.com

    Other important reads:

    community.dynamics.com/.../auto-numbering-through-real-time-workflows-no-customization-no-add-on

    survivingcrm.com/.../auto-numbering-workflows-real-time-vs-asynchronous

  • PS Profile Picture
    PS 23,577 on at
    RE: Auto-Numbering Account Entities on Import

    Which version of CRM you are using?

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans