5 Replies Latest reply on Mar 12, 2018 8:35 AM by BillCampbell

    New Recurrence Patterns on Recurring Activity Management Design App

    BillCampbell Apprentice

      Has anyone had any success creating new Recurrence Patterns for use with the Recurring Activity Management Design App?

       

      I've been working with Support on this as well but I'm interested in ideas from the community.

      I'm tackling understanding Boo, so my calculations may not be correct even though they pass syntax.

       

      Based on the modified calculation by Support (thanks Martyn) to recur on Monthly, I attempted to calculate for Quarterly and Annual as well.

      Please have a look at my calculation formula from the Create Task attribute on the Recurring Activity business object in the Recurring Activity Management module and see if it makes sense.

       

      if RecurringActivity._RecurringActivityPattern._Name == 'Monthly':

                     currentDate  = RecurringActivity._StartDate.Day

                     if currentDate == DateTime.UtcNow.Day and RecurringActivity._StartDate.AddHours(1).Hour == DateTime.UtcNow.Hour:

                             return true

       

              if RecurringActivity._RecurringActivityPattern._Name == 'Quarterly':

                     currentQuarter = RecurringActivity._StartDate.Month

                     if currentQuarter == ((DateTime.Now.Month - 1) / 3) + 1 and RecurringActivity._StartDate.AddHours(1).Hour == DateTime.UtcNow.Hour:

                             return true

              if RecurringActivity._RecurringActivityPattern._Name == 'Annual':

                     currentYear = RecurringActivity._StartDate.Year

                     if currentYear == (DateTime.Now.Year - 1) + 1 and RecurringActivity._StartDate.AddHours(1).Hour == DateTime.UtcNow.Hour:

                             return true        

       

      Additionally, is there a recommended method of testing this?

      I have been creating an Activity and advancing the date and time on the server to force the Activity to create the tasks. I'm wondering if there is another method that might be better.

       

      Any advice would be greatly appreciated.

        • 1. Re: New Recurrence Patterns on Recurring Activity Management Design App
          Senta SupportEmployee

          Hello BillCampbell ,

           

          looking at your calculation I seem to miss some information, as I do not understand why first check for the recurrence (Day, Quater, Year) and the add an Hour to the Start Date to check if this is the current hour.

          The last check doesn't seem to make sense if you just want to check if the Start Date falls into your pattern.

           

          So I focus more on the second part of your question, the testing, in the hope that this will bring you forward.

           

          Instead of using DateTime.UtcNow, you can use a placeholder DateTime with a Date of your choosing.

          This allows you testing the calculation with any date(s) and later you just go live by assigning DateTime.UtcNow to your placeholder.

           

          Here a test calc from my lab performing the tests and returning a string to show the result of the tests.

           

          import System

          static def GetAttributeValue(Incident):

               CurrentDate = DateTime.Parse("2018-01-03T07:34:42-5:00") // replaces DateTime.UtcNow

               DateToCheck  = DateTime.Parse("2008-03-03T07:34:42-5:00") // replaces RecurringActivity._StartDate

               Value = ''

           

               // check for same Day of the Month (aka Monthly)

               Value += "\nCurrentDay: " + CurrentDate.Day + " DateToCheck: " + DateToCheck.Day + " - "

               if CurrentDate.Day == DateToCheck.Day:

                    Value += "Same Day - "

           

               // check for same (year) quarter not fiscal quarter

               Value += "\nCurrentQuater: " + (Math.Abs((CurrentDate.Month - 1) / 3)+1) + " QuaterToCheck: " + (Math.Abs((DateToCheck.Month - 1) / 3)+1) + " - "

               if (Math.Abs((CurrentDate.Month - 1) / 3)+1) == (Math.Abs((DateToCheck.Month - 1) / 3)+1):

                    Value += "Same Quarter - "

           

               // check for same year

               Value += "\nCurrentYear: " + CurrentDate.Year + " YearToCheck: " + DateToCheck.Year + " - "

               if CurrentDate.Year == DateToCheck.Year:

                    Value += "Same Year"

           

               return Value

           

          In this example, it should give you

           

          2018-01-03_15-22-33.png

           

          Regards

          Ivanti Support

          1 of 1 people found this helpful
          • 2. Re: New Recurrence Patterns on Recurring Activity Management Design App
            BillCampbell Apprentice

            Thank you Senta, I had not considered hard coding the date into the code.
            I'll take your recommendations, see how it turns out and post my results.

            • 3. Re: New Recurrence Patterns on Recurring Activity Management Design App
              BillCampbell Apprentice

              Just an update to our progress on this code...
              We've been working on Xtraction reports for the end of 2017 and beginning of 2018 - so there's been a slight pause with the recurring activity module.

              We'll begin working on it again during the early part of next week and should be able to provide an update shortly thereafter.

              • 4. Re: New Recurrence Patterns on Recurring Activity Management Design App
                Motaz ITSMMVPGroup

                Hi Bill,

                 

                Do you have any update on that?

                • 5. Re: New Recurrence Patterns on Recurring Activity Management Design App
                  BillCampbell Apprentice

                  We ended up using the Recurring Activity Management Design App as a base and had to completely rewrite the calculations to include what we needed (quarterly, biannual, and annual) plus create a new process flow to make a Request out of the Recurring Activity.

                  Although we are still building this out for our customer, the original question is no longer valid.

                   

                  I've marked the calculations provided by Senta as Helpful because they seem relevant, but in the end we have gone a different direction.