3 Replies Latest reply on Aug 22, 2018 12:04 AM by ItsmCSL

    Use of Global Constant to calculate/display timezone adjusted Need By date in Email?

    MarkLarvo Specialist

      Good day!

       

      I have a theoretical question before I spend time testing.

       

      BACKGROUND

      We have locations in 6 time zones. Our I/SR/Task notifications include a Need By date field. Right now they display only in our home office time zone of Central Time (CT).

       

      All I/SRs have a field to record the location code of the Reported For/Reported By user. We also have an Is Visiting checkbox which allows for an override location when a user is not in their home location.

      Incident IsVisiting sample.png

      In this example, the notification would go out with a datetime of 7/16/2018 12:00 PM (CT). All locations except the Central time zone have to do the math to determine the Need By time for their location. Not a very global attitude...

       

      QUESTION

      Could one create a Global Constant that contains all of the formatting to calculate the datetime based on the provided location code?

      $(If IsNull(NeedByDateTime) then "" else If LocationCode in list("SF", "LA") then FormatDate(NeedByDateTime, "MM/dd/yyyy hh:mm tt", "America/Los Angeles") + " PT" else if LocationCode in list("CH", "HU") then FormatDate(NeedByDateTime, "MM/dd/yyyy hh:mm tt", "America/Chicago") + " CT" etc...?

       

      I ask this as I would not want to edit this if statement in every notification should we open an office in a new location and have a new location code.

       

      I think this is a yes, but looking to see if there are caveats to consider?

       

      *We are exploring adding the Timezone field for the NeedBy and Defer/Follow up fields since our data entry is done globally.

        • 1. Re: Use of Global Constant to calculate/display timezone adjusted Need By date in Email?
          ItsmCSL Apprentice

          Hi,

          sorry for the offtopic. I can't help you with your current issue but I'm refering to your screenshot. The little icon behind the username looks like a skype/lync Icon. Did you guys archived an integration between Skype/Lync and Service Manager?

          Again, sorry for the offotpic.

          • 2. Re: Use of Global Constant to calculate/display timezone adjusted Need By date in Email?
            MarkLarvo Specialist

            Christian,

             

            No worries.

             

            We run the full Skype for Business App. Our supported browser is IE which in our environment formats anything it can recognize as a phone with that icon and become Skype clickable. I don't know if thats a native thing with the Skype install or if it is an IE plugin in our machine build. My understanding is that it just will not work in Chrome and at one time there was a Chrome plugin but that was likely before it became a MS product. :-(

             

            The hard part was actually taking the numbers from our global locations and formatting them so Skype would recognize them all AND they were in formats acceptable for each country. The best format I came up with was "+countrycode" + space + formatted number.

             

            We have a country code field number field and a Full number field. Here's our code using a Before Save rule:

             

            Calculation rule for Employee.KE_Phone1Full

             

            $(case

              when Len(trim(KE_Phone1CountryCode)) == 0 || Len(Phone1) == 0

                   then null

              when trim(KE_Phone1CountryCode) in ("86",  "44")

                   then "+" + trim(KE_Phone1CountryCode) + " " +

                        Substring(Replace(Phone1,  "-",  ""),  1,  2) + "-" +

                        Substring(Replace(Phone1,  "-",  ""),  3,  4) + "-" +

                        Substring(Replace(Phone1,  "-",  ""),  7,  4)

              when trim(KE_Phone1CountryCode) == "49"

                   then "+" + trim(KE_Phone1CountryCode) + " " +

                        Substring(Replace(Phone1,  "-",  ""),  1,  2) + "-" +

                        Substring(Replace(Phone1,  "-",  ""),  3,  8)

              when trim(KE_Phone1CountryCode) == "852"

                   then "+" + trim(KE_Phone1CountryCode) + " " +

                        Substring(Replace(Phone1,  "-",  ""),  1,  4) + "-" +

                        Substring(Replace(Phone1,  "-",  ""),  5,  4)

              else "+" + trim(KE_Phone1CountryCode) + " " +

                   Substring(Replace(Phone1,  "-",  ""),  1,  3) + "-" +

                   Substring(Replace(Phone1,  "-",  ""),  4,  3) + "-" +

                   Substring(Replace(Phone1,  "-",  ""),  7,  4))

             

            Hope that helps!

            1 of 1 people found this helpful