February Mission - Create desired patching dates in calender

Document created by janvonreith on Feb 5, 2017
Version 1Show Document
  • View in full screen mode

I created a default calender list called "Calendar", where the desired patching dates will be stored.

 

Furthermore I created a custom list called "Server and patching dates", where I stored the servers and the patching days, whereby I didn't store a real date, but the count of the days after the so called "Patching Tuesday". I decided to go for a dedicated list for that information, so that it's not necessary to change the workflow if the dates/days will need to be changed.

 

 

I've set up a site workflow that will run on the first day of every month. The workflow should get the second tuesday with the help of a loop action and then calculate the other dates with the help of that date and the list "Server and patching dates".

 

The workflow looks like this:

 

I defined a variable called "varDate" with "Today" as the default value. With the "Build string" action I format the date into a friendly date that includes the name of the day, this value is stored in the variable "varDateString".

 

 

This action is followed by a "Run if" action. This action only runs if the variable "varDateString" contains "Tuesday". If this is the case I add +1 to a variable called "varTuesdayCount". I'm already checking the "varDateString" at the beginning of the workflow to get to know if the workflow maybe started on a tuesday. 

 

Afterwards I added a "Loop" action. The loop action will run until "varTuesdayCount" is equal to 2. In the loop action the variable "varDate" is increased by +1 for every loop. Like at the beginning of the workflow I used the the "Build string" action to format the date into a friendly date that includes the name of the day, the value again get's stored in the variable "varDateString".

 

This action is again followed by a "Run if" action. This action only runs if the variable "varDateString" contains "Tuesday". If this is the case I add +1 to the variable "varTuesdayCount".

 

 

Directly after the loop I store the current "varDate" into another variable called "varPatchTuesdayDate", because I want to use the "varDate" variable later on in the context of different date calculations for the single servers.

Then I added a "Query list" action to store all server names and the corresponding day counts into collection variables called "varServerCollection" and "varDayCountCollection".

 

 

Now I added a "For each" action to iterate through all servers in the collection variables.

 

 

 

In every iteration I first get the day count for the current server with the help of a "Collection operation".

 

 

In the "Calculate date" action I calculate the patching date for the current server. The result get's stored in the variable "varDate".

 

 

In the "Create Item" action I create the calendar entry for the current server.

 

The good thing about using a "For each" action in this case is, that the solution can also deal with additonal servers that maybe will be added to the "Server and patching dates" list, so it's very flexible.

 

The result in the calendar looks like this :-)

 

1 person found this helpful

Attachments

    Outcomes