Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum

Auto number : Reset the value if it was not changed today?

Posted on by 580

I have a auto number field which will reset based on Frequency - Daily, Monthly and yearly. if Daily selected the value of NEXT number has to set to 1 .How to check if the value of field was changed today then don't update otherwise update the value.

  • Suggested answer
    Kokulan Profile Picture
    Kokulan 18,048 on at
    RE: Auto number : Reset the value if it was not changed today?

    Hi

    I assume you are doing the auto number in a plugin, you could do the following

    With the Frequency (Daily/Monthly/Yearly) field, you could also have another field that is datetime - lets call it Next Number Last Modified On

    In your auto number logic, if the Frequency is set to Daily, check the Next Number Last Modified On datetime field value.

    If its null or if last modified date is before today, you can reset the Next value.

    If the value was changed today, you do not need to reset, you increment it by one.

  • Suggested answer
    LeoAlt Profile Picture
    LeoAlt 16,329 on at
    RE: Auto number : Reset the value if it was not changed today?

    Hi partner,

    1.If we want to know if a field has been updated or changed(value or properties), you should enable the audit of this field and then you will be able to see all logs in Audit History.

    community305.png

    https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/auditing-overview

    https://crmbook.powerobjects.com/basics/data-management-in-microsoft-dynamics-crm/auditing-in-microsoft-dynamics-crm/

    If you want to enable the field audit, you could go to field property form and select "Enable" beside "Auditing" label.

    community305.png

    2.By the way, if you want the system check it automatically, you should add a workflow and set the trigger condition as "when autonumber field changed and not equal '1'" and then update the field value to '1'.

    community307.png

    Hope it helps.

    Best Regards,

    Leo

  • AndrewLy365lyf Profile Picture
    AndrewLy365lyf 1,356 Most Valuable Professional on at
    RE: Auto number : Reset the value if it was not changed today?

    Just wondering, why use ootb auto number for this?  You could have a background workflow/plugin perform this a little more cleanly.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

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,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans