web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Workflow or Bulk Deletion Job to Calculate a date?

(0) ShareShare
ReportReport
Posted on by

Hi there,

We recently migrated from CRM2011 to Dynamics365 and with all the new enhancements we received I am unsure of what to use; workflow / Bulk Deletion Jobs / Auto Calculate Fields / Plugin? ...

Description of our issue:

Looking to automatically update/increment a date/time field by 10 years and check against current date time, if current date/time has passed then increment by another 10 years etc.

-The (new) field 10 Year Renewal Date field should auto calculate a date 10 years after the (existing) Policy Date has passed.

-Additionally if the 10 Year Renewal Date field has passed or is greater that Current Date() then it should add 10 more years.

-For example, if the Policy Date is August 24, 2007, then the 10 Year Renewal Date would be August 24, 2017. If the date (Aug 24, 2017) has already passed, can you update it for 20 years etc. Example, 10 Year Renewal Date would be August 27, 2026.

I looked into Auto Calculated Fields but it has many limitations such as cannot trigger events when field is certain value or cannot be used to sort in Views so I abandoned this approach.

I would greatly appreciate if someone can guide me in best direction if you have done something similar.

Cheers,

Pieter

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Aiden Kaskela Profile Picture
    19,696 on at
    RE: Workflow or Bulk Deletion Job to Calculate a date?

    Hi Pieter,

    The bulk of this can be handled with a workflow, the difficulty will be kicking it off (which I'm a little unclear on). It sounds like it's not just when the date passed because you need to account for cases where (old date + 10 years) is still in the past. Is this because you need to account for old policies the first time?

    To calculate the date, it's pretty easy in a workflow if you install Workflow Elements (it's free at https://KaskelaSolutions.com ). There are two ways to do it - one is pretty and probably not the best way, the other is ugly but probably the way to go.

    First Way - Recursive Updates

    1. Check (if Policy Date is less than today and 10 year date is null)

    -> Set 10 year date to policy date + 10 years

    -> Kick off this workflow again as a child record

    -> End workflow

    2. Check (if 10 year date is in the past)

    -> Set 10 year date to 10 year date + 10 years

    -> Kick off this workflow again as a child record

    -> End workflow

    Second Way - brute force it

    1. Check if policy date is in the past, and 10 year date is null or in the past

    ->  Call custom activity 'Date - Add or Subtract' and get back output parameter (date + 10 years)

    --> Check if  (date + 10 years) is in the future, if so, update the record with this value

    --> Otherwise, call custom activity 'Date - Add or Subtract' and get back output parameter (date + 20 years)

    ----> Check, update, else increment, on and on and on.

    You would want to you these parameters instead of updating the record each time because otherwise you would have one Update call each time you want to increment it and that would be unnecessary.

    Let me know about the triggers and I can advise on that.

    Hope this helps! I'd appreciate if you'd mark this as Answering your question.

    Thanks,

     Aiden

  • Pieter Janse van Niewenhuizen Profile Picture
    on at
    RE: Workflow or Bulk Deletion Job to Calculate a date?

    Thanks Aiden,

    I have not had time yet to try this using Workflow Elements, however I will try this on Thursday and let you know the results.

    Thank you for your quick response.

    Pieter

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans