Skip to main content

Notifications

Announcements

No record found.

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

  • Karuna Karan Profile Picture
    Karuna Karan 1,210 on at
    RE: Auto increment based on conditions

    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.

  • Verified answer
    Bipin D365 Profile Picture
    Bipin D365 28,959 Super User 2024 Season 1 on at
    RE: Auto increment based on conditions

    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.

  • _nanu2208 Profile Picture
    _nanu2208 105 on at
    RE: Auto increment based on conditions

    Hi Lu Hao,

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

  • _nanu2208 Profile Picture
    _nanu2208 105 on at
    RE: Auto increment based on conditions

    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
    _nanu2208 105 on at
    RE: Auto increment based on conditions

    Hi Bipin,

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

  • LuHao Profile Picture
    LuHao 40,874 on at
    RE: Auto increment based on conditions

    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.

  • Verified answer
    Karuna Karan Profile Picture
    Karuna Karan 1,210 on at
    RE: Auto increment based on conditions

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

    celedonpartners.com/.../

    Let me know if you need more help.

  • Verified answer
    Bipin D365 Profile Picture
    Bipin D365 28,959 Super User 2024 Season 1 on at
    RE: Auto increment based on conditions

    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.

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans