Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

auto changing status of a record to inactive on a given date

(0) ShareShare
ReportReport
Posted on by 1,703

CRM2016

When a customer (account entity)  cancels their contract with us, we set their new_servicestatus to cancelled (new_servicestatus  optionset value 2 )

What I would like to do is when the option is set to cancelled, to trigger a scheduled task to deactivate the account on the 10th of the following month

The reason for this is to ensure that the customer is billed for their notice period.

I don't know if I need to put in a field for cancelled and a task is driven from this

I would welcome any advice as to if this can be done and any example code if possible.

*This post is locked for comments

  • Verified answer
    Aiden Kaskela Profile Picture
    19,694 on at
    RE: auto changing status of a record to inactive on a given date

    Hi Pete,

    You can have a workflow sleep (or timeout) until a certain date, but out of the box you can't set the sleep date as "10th of Next Month" - you either need to put in a duration or a specific date. The problem is that you have a relative month.

    There is a free add-on I built that will let you do this though - it's called Workflow Elements and it's available from https://kaskela.wordpress.com Install that solution and you'll be able to build your workflow like so:

    1) Call activity "Date – Add or Subtract" and pass in the workflow execution date (today), and 1 month. This returns a date time value for a month from now.

    2) Call activity "Date - Get Date Components" and pass in the date returned in step one. This has output parameters you'll need in the next step.

    3) Call activity "Date - Build Date From Parts" and pass the following parameters, in order to get the 10th of next month.

    3a) Day of Month = 10

    3b) Month of Year (1 – 12) = (Month of Year (1 – 12) from step 2)

    3c) Year = (Year from Step 2)

    4) Sleep/Timeout until the date returned in Step 3

    5) Deactivate the account

    Hope this helps! Let me know if you have any issues. I'd appreciate if you'd mark this as Answering your question.

    Thanks,

     Aiden

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >

Featured topics

Product updates

Dynamics 365 release plans