Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

How to set a value in a custom field and increment by 1 each time the new record is created.

Posted on by 340

I want to set a default value in a custom whole number field say for e.g 200000 and there after every time a new record is created the same custom field value should be automatically incremented by 1 on new record  for e.g 200001,200002. How can i achieve this.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to set a value in a custom field and increment by 1 each time the new record is created.

    HI Sandy,

    We have an addon auto counter for Dynamics 365 CRM. I hope it will help you get through these issues. Auto-Counter allows the user to configure counter for default as well as custom entities. Here, you can put any prefix, suffix, counter zero paddings and specified date formats with Auto numbering.

    Below is the link:  www.solzit.com/.../

  • Fubar Profile Picture
    Fubar 2,752 on at
    RE: How to set a value in a custom field and increment by 1 each time the new record is created.

    It you need the number to be unique you will probably have problems if you attempt to do it with JavaScript, or Workflow.  Plugins it can be done but they have to be put together correctly or you will probably end up with duplicates (need to remember multiple users, threads, record locks etc etc).  Some people have even created their own WebServices to achieve unique auto numbers due to the issues with getting it right in CRM.

    Autonumber field is probably the best option these days.

  • Suggested answer
    RE: How to set a value in a custom field and increment by 1 each time the new record is created.

    Hi Sandy Hello how are you?

    Yes, you can do that. But think that you have to create the structure to save the number, the next number, prefix and suffix.

    You can use a plug-in using the SDK and samples on it to retrieve the configuration from this entity and on the pre create add the counter. Using java script is the same approach. You have to query this entity, create the number and add it on the attribute on form.

    I think that this is not so easy as the Auto Number plug-in and the Dynamics platform will increment and create the value to you.

  • Sandy Hello Profile Picture
    Sandy Hello 340 on at
    RE: How to set a value in a custom field and increment by 1 each time the new record is created.

    Hi Rodrigo thanks for your response, I am good hoping you are also doing good, instead of Auto Number plugin is there any possibility to achieve this with Java script or Work flow process

  • Suggested answer
    RE: How to set a value in a custom field and increment by 1 each time the new record is created.

    Hi Sandy Hello how are you?

    I think you can check this article about auto number https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/create-auto-number-attributes.

    On it we also have a recommendation to use the Auto Number plug-in for Xrm Toolbox to add it

    You do not need to add the new attribute on form. In my sample below I created the attribute at fax entity using XrmToolbox and add it on the view .

    2020_2D00_10_2D00_06_2D00_001.jpg

    Please let me know if this information helped on your question.

     

    Regards.

    Rodrigo Hentz

    Microsoft Support Engineer

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,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans