How to Automate T-minus Emails

Modified on Wed, 24 Sep at 11:03 AM

TABLE OF CONTENTS


Introduction

A common use case when managing a transformation projects is to be able to send emails on a schedule. This article covers two scenarios: 

  1. Auto-Sending the Self-Scheduling Email
    The user has been added to a Deployment Unit, but does not have a migration slot. In this case it's necessary to send the user a self-scheduling email so that they can choose their migration slot.

  2. Auto-Sending a T-Minus 10 Email
    The user has chosen their migration slot and follow up comms need to be sent.

1. Auto-Sending the Self-Scheduling Email

When planning Deployment Units, it's important to consider the timing of the self-scheduling email. This email includes a booking link that allows users to select a migration slot within their assigned Deployment Unit. The ESM plan must cater for two scenarios:


Standard Timing:  Deployment teams typically require this email to be sent 1–2 weeks before the start of the Deployment Unit. This ensures users have enough time to book their slot in advance. The example here is to send the email 2 weeks before.


Late Additions:  If a user is added to a Deployment Unit after deployments have begun.


Schedule Settings

The emails sent by this ESM Plan will be begin to be sent at the time the plan runs, and be spread over two hours. It's therefore recommended that the plan is set to run daily at midday.


The email should only be sent to each user once, so Always Re-Run ESM Plan should not be ticked.


For testing leave the Schedule To Run At #1 blank.


Service Plan Rules (Evaluator)


Rule Name

Rule Type

Data Location

Operator

Criteria

Up to 14 days before

Field

DeployUnitStartDate

<=

[Today + 14]

During Deployments

Field

DU:EndDate

>=

[Today]

User not booked alreadyField

DeployUnitSlotStart

==[blank]
Limit to test DUFieldDU:DeployUnit==Test DU


Rule 1: This will cater for User Migrations who are in a DU which has a start date within 14 days from the current day. This will cater for people who were either added to the DU at least 14 days before the DU start date, or for people who were added within 14 days of the start date.


Rule 2: This is for User Migrations who are added to the DU once the start date has passed, but before the end date of the DU. It ensure these people don't miss out on the email.


Rule 3: Ensures the user does not have a slot booked already.


Rule 4: Limits the ESM Plan to only run against users in the test Deployment Unit


Plan Actions


EventActionTargetParam

On Publish

Send Email

Self-Schedule - Request Email

Schedule:[TimeStamp]


This will start to send the emails when the ESM Plan runs, and spread them over the default time period (two hours).


Test the Plan

  1. Setup a test Deployment Unit called Test DU with User Migrations as the Target and a start date 10 days in the future.

  2. Add a test User Migration to this DU, and ensure they don't have a migration slot.

  3. In the ESM Plan click Run Plan Evaluator and ensure there is only 1 pass in the log.

  4. Click Clear History, Run Eval, Schedule & Publish.

  5. Check the Action Log. There should be 1 item Completed.

  6. Check the Email Queue. A Self-Scheduling Email should be sent to the test user. Note that the built-in deduplication check may prevent this if this email has already been sent.

  7. Once it's all setup and working remove Rule 4 from the Service Plan Rules and set Schedule to Run #1 under Schedule Settings as required.

2. Auto-Sending a T-Minus 10 Email 

Prepare Prerequisites

  1. For testing create a Blueprint and add a test User Migration to it
  2. Setup an email template. Administration -> User Migrations -> Email Templates -> Click here to add new item
    1. Email Name: <As required> e.g. "T-minus 10 days"
    2. Subject: <As required> e.g. "Windows 11 Project - 10 days to go..."
    3. Click on the script icon and add the email content. This can be either markdown or HTML.
    4. Click Save Changes

Create the ESM Plan

  1. Administration -> Extensions -> Servicing Plans -> User Migration Plans
  2. Service Plans -> New Service Plan
    1. Plan Name: <As required> e.g "T-minus 10 days email", click New Plan
    2. Schedule Settings -> Tick Reset Prior to Run
  3. Data Source -> Deselect All User Migrations option
  4. Data Source -> Only run on User Migrations in the test Blueprint
  5. Add the test User Migration to a Deployment Unit with a start date and end date which include a date seven days from today
  6. Now the test User Migration needs a migration slot: User Migrations -> All User Migrations -> Double click your user record -> click Update Migration Slot -> Set the migration slot to 7 days in the future from today -> Update
  7. Now we need to ensure the plan only runs against the relevant User Migrations. In the screenshot below the Evaluator is searching for users who are being migrated in the next 13 days (it's 13 rather than 10 to ensure emails aren't sent on a weekend, but rather the Friday before).
  8. Browse to Service Plan Rules -> Add New Setting:
  9. Add the two rules below:
  10. Notes:
    • Rule 1: The Criteria search start date should be set to [Today] to catch late additions to the schedule. I.e. If a user was scheduled to be migrated three days from [Today], they should still receive the email.
    • Rule 2: This defines the search end date. The Criteria should be at least three days greater that the T-minus time in case it falls on a weekend, in which case the email will be sent on the Friday before. In this case it's a T-minus 10 days email, so the criteria is [Today + 13]
    • The email Schedule date (the date the email is actually sent) is dictated by the Plan Actions (not the evaluator rules) which in this case will always be 10 days prior to the migration date. This is configured in a later step. The email queue will therefore show a set of emails scheduled to be sent in the near future for users being migrated in the next 10 days.
    • The email content is generated at the time the email is sent, NOT when it is queued. This ensures the user gets the latest version of the email.
    • It is possible to combine the two rules into a single rule. For examples see the Reference section below.
  11. Click Validate Plan Rules and ensure they pass
  12. Now the action must be created. In Service Plan Actions (Publisher) click Add New Setting
  13. Setup as in screenshot below.
    Ensure the Target matches the email name exactly
    Set Param to Schedule:[DeployUnitSlotStart - 10 @ 08:00];DuplicateCheck:100;LateEmailLimit:10
  14. Notes:
    • The DuplicateCheck setting ensures that duplicate emails are not sent. Set this to at least the t-minus days
    • The LateEmailLimit setting ensures that emails with a scheduled send date which is a long time in the past are not sent in error. Set this to the t-minus days.
  15. Click Validate Plan Actions and ensure it passes

  16. Sae the plan


Test the Plan

  1. Click Clear History, Run Eval, Schedule & Publish

  2. Check the test User Migration, Service Plans tab, ensure all logs are as expected

  3. Once it's all setup and working remove the test Blueprint from the plan source (it may be useful to target a specific process for production) and set a Schedule to Run under Schedule Settings as required

Reference



 

Rule NameRule TypeData Location

OperatorCriteriaDescription
Has a date setFieldDeployUnitSlotStart!=[Blank]Identifies all assets which have been added to a slot in the DU
Has no date setFieldDeployUnitSlotStart==[Blank]Identifies all assets which have not been added to a slot in the DU
More than 10 days to go (Inclusive)FieldDeployUnitSlotStart>=[Today + 10]Identifies all assets with more than 10 days until they are due to be migrated
Less than 10 days to go (Inclusive)FieldDeployUnitSlotStart<=[Today + 10]Identifies all assets with less than 10 days to go until they are due to be migrated
More than 10 days ago (Inclusive)FieldDeployUnitSlotStart>=[Today - 10]Identifies all assets which have a migration slot more than 10 days ago
Less than 10 days ago (Inclusive)FieldDeployUnitSlotStart<=[Today - 10]Identifies all assets which have a migration slot less than 10 days ago
In the futureFieldDeployUnitSlotStart>[TimeStamp]Identifies all assets which are due to be migrated in the future
In the pastFieldDeployUnitSlotStart<[TimeStamp]Identifies all assets which have a migration slot in the past
Is Between 5 & 10 Days to goFieldDeployUnitSlotStartIs the DayBetween [Today + 5] & [Today + 10]Identifies all assets which are due to be migrated between 5 days and 10 days in the future
Not Between 5 & 10 Days to goFieldDeployUnitSlotStartNot the DayBetween [Today + 5] & [Today + 10]Identifies all assets which are not due to be migrated between 5 days and 10 days in the future (Eg. a user who is due to be migrated tomorrow; a machine which is due to be migrated in 12 days' time, any asset which has a slot in the past)
Is Between 5 & 10 Days agoFieldDeployUnitSlotStartIs the DayBetween [Today - 5] & [Today - 10]Identifies all assets which have a migration slot between 5 days and 10 days ago
Not Between 5 & 10 Days agoFieldDeployUnitSlotStartNot the DayBetween [Today - 5] & [Today - 10]Identifies all assets which do not have a migration slot between 5 days and 10 days ago (Eg. a user with a migration slot 15 days ago; a machine which is due to be migrated in 2 days' time)
Three days to go between 1pm & 7pmFieldDeployUnitSlotStartIs the DayBetween [Today + 3 @13:00] & [Today + 3 @19:00]Identifies all assets which are due to be migrated in 3 days' time, between 1pm and 7pm
Three days ago between 1pm & 7pmFieldDeployUnitSlotStartIs the DayBetween [Today - 3 @13:00] & [Today - 3 @19:00]Identifies all assets which have a migration slot 3 days' ago, between 1pm and 7pm
DeployUniitStart = 2021-01-25FieldDeployUnitSlotStartIs the Day25/01/2021Identifies all assets which are due to be migrated on the 25/01/2021
Compare two datesCompare FieldsDeployUnitSlotStart<=DU:EndDateIdentifies all assets which have a slot which falls in between two dates

Further Support

If you require further support, please visit ManagementStudio's Service Desk to search the knowledge base or create a new support ticket.


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article