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 :
Customer experience | Sales, Customer Insights,...
Answered

Auto increment based on conditions

(0) ShareShare
ReportReport
Posted on by 105

Hi,

I have different combinations of values of 2 fields(OEM,Subgrp).  For each combination, I want ID in Autoincrement mode.  So each combination will start with 001. And then increment based on same condition. How this can be achieved?

For ex.  screenshot shown in excel:

pastedimage1594452190556v2.png

Regards,

nanu

I have the same question (0)
  • Verified answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    You should write plugin on pre operation on create message. In plugin code check existing record auto number value order by modified on desc to take latest record. And increase the vaue by 1.

    You need to make sure to implement locking mechanism to not create duplicate auto number.

    see below article on how to implement lock in plugin

    xrmdynamicscrm.wordpress.com/.../

    If found helpful, Please mark my answer verified.

  • Verified answer
    Karuna Karan Profile Picture
    1,212 on at

    Have you tried Celedon Autonumber solution? it provides options to generate condition based autonumber.

    celedonpartners.com/.../

    Let me know if you need more help.

  • LuHao Profile Picture
    40,892 on at

    Hi partner,

    Are you using D365 online or OP.

    For D365 online, we could use power automate to do it, which is no code way.

  • _nanu2208 Profile Picture
    105 on at

    Hi Bipin,

    I'm new to this..  Can you please give me any link which helps to write plugin.

  • _nanu2208 Profile Picture
    105 on at

    Hi Karunakaran,

    Does this solution supports condition based on combination of field values?

    For example

    Column1 Column2  IDField

    A                   B                001

    A                   C                001

    A                   B                002

    B                   C                001

  • _nanu2208 Profile Picture
    105 on at

    Hi Lu Hao,

    I tried this solution. It is not showing product entity.

  • Verified answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    HI,

    To implement lock check below article.

    xrmdynamicscrm.wordpress.com/.../

    Basic plugin code is already available under SDK folder SDK\SampleCode\CS\Plug-ins

    Check AccountNumberPlugin sample code under plug-ins folder in SDK

    Download SKD Link - www.microsoft.com/.../details.aspx

    If found helpful, Please mark my answer verified.

  • Karuna Karan Profile Picture
    1,212 on at

    If you are going to specify the both the Column values in a transactional form and system should generate the next sequence # for that unique combo, then plugin is the best option. You need to maintain a setup entity which contains (column1 lookup, column2 lookup, autonumber length, next number, prefix, suffix, etc.). Plugin should execute synchronous on target record create.

    Flow is also an alternative if you are using CRM online, but it executes Asynchronously, and Users might not prefer it for such solution.

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 96 Super User 2025 Season 2

#2
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans