Question
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Pegasystems Inc.
IN
Last activity: 10 Dec 2021 11:59 EST
How to change Operator time zone based on their browser time or windows timezone
How to set By Default Operator's time zone based on his browser's timezone whenever he login into pega application automatically
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/2023-06/73f362c8-b832-40d3-925c-157022b712a7.jpg?h=57870c3e&itok=F1Dfwfd6)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/2023-06/73f362c8-b832-40d3-925c-157022b712a7.jpg?h=57870c3e&itok=F1Dfwfd6)
Ford Motor Company
US
We wrote a hidden custom section on the Main Section [preferably on the Header section] to add a logic to calculate the timezone based on the offset from a Decision Table.
Java Step to calculate the offset:
String timezoneoffset = tools.getParamValue("tzOffset"); offsetVal = timezoneoffset; offsetNumber = offsetVal.substring(3);
Script for the Non-Auto generated section:
<script type="text/javascript"> function getOffsetLocale(){
var currDate = new Date(); var userOffset = -currDate.getTimezoneOffset() / 60;
userOffset = "GMT" + userOffset; if(userOffset.indexOf("-")<0){ userOffset = userOffset.replace("GMT","GMT+"); }
var oSafeURL = new SafeURL(); oSafeURL.put("pyActivity","Data-Admin-Operator-ID.SetDefaultTimezone"); oSafeURL.put("tzOffset",userOffset); pega.u.d.asyncRequest("POST", oSafeURL); }
getOffsetLocale(); </script>
Based on the offset, we are calling two different DT's to return a timezone and which will be updated to operator timezone property during Single Sign On.
We wrote a hidden custom section on the Main Section [preferably on the Header section] to add a logic to calculate the timezone based on the offset from a Decision Table.
Java Step to calculate the offset:
String timezoneoffset = tools.getParamValue("tzOffset"); offsetVal = timezoneoffset; offsetNumber = offsetVal.substring(3);
Script for the Non-Auto generated section:
<script type="text/javascript"> function getOffsetLocale(){
var currDate = new Date(); var userOffset = -currDate.getTimezoneOffset() / 60;
userOffset = "GMT" + userOffset; if(userOffset.indexOf("-")<0){ userOffset = userOffset.replace("GMT","GMT+"); }
var oSafeURL = new SafeURL(); oSafeURL.put("pyActivity","Data-Admin-Operator-ID.SetDefaultTimezone"); oSafeURL.put("tzOffset",userOffset); pega.u.d.asyncRequest("POST", oSafeURL); }
getOffsetLocale(); </script>
Based on the offset, we are calling two different DT's to return a timezone and which will be updated to operator timezone property during Single Sign On.
Updated: 26 Mar 2021 7:27 EDT
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Pegasystems Inc.
IN
Hi Suman,
Thank you for your response. But as soon as User login i want to update their Timezone dropdown valueIST/AST/EST... based on their browser session.
I have attached screenshot where i want to update Timezonedrop down in OperatorId
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/2023-06/73f362c8-b832-40d3-925c-157022b712a7.jpg?h=57870c3e&itok=F1Dfwfd6)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/2023-06/73f362c8-b832-40d3-925c-157022b712a7.jpg?h=57870c3e&itok=F1Dfwfd6)
Ford Motor Company
US
@LakshmiSwathi Please see the logic below, we are setting the Operator ID timezone based on the Browser Offset value
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Pegasystems Inc.
IN
@SUMAN_GUMUDAVELLY : still not clear on your custom section embedded in header section, is it harness header section?. please elaborate along with your SSO mechanism. we have similar requirement through Open ID SSO by using authentication service alias in 8.6.2. Pega is not loading any section instead directly redirecting to identity provider for authentication. Thanks!
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/2023-06/73f362c8-b832-40d3-925c-157022b712a7.jpg?h=57870c3e&itok=F1Dfwfd6)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/2023-06/73f362c8-b832-40d3-925c-157022b712a7.jpg?h=57870c3e&itok=F1Dfwfd6)
Ford Motor Company
US
@pradeepp4826 The section which I refferred is the Work Area Gadget which is refferred in the Harness Rule from the Portal rule.
When browser loading the section, we are doing two things:
Getting the Browser Offset value [Please see screenshots]
Once the Offset is available , with the help of Decision table mentioned in previous response, we are deriving the TimeZone and updating the Operator record.
Hope this helps.
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Pegasystems Inc.
IN
Thanks @SUMAN_GUMUDAVELLY.! really appreciate the response. seems like you are using login screen to get user credentials where you configured this HTML code to get the offset, in our case as we are relaying on authentication service alias (/prweb/PRAuth/xxx-xxx) Pega is immediately redirecting to identity provider for authentication, so were not able to find out a place to get it from browser and process it in post authentication activity. So we configured in portal dashboard to update the operator profile first time. Not perfect solution though. Thanks!
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/2023-06/73f362c8-b832-40d3-925c-157022b712a7.jpg?h=57870c3e&itok=F1Dfwfd6)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/2023-06/73f362c8-b832-40d3-925c-157022b712a7.jpg?h=57870c3e&itok=F1Dfwfd6)
Ford Motor Company
US
@pradeepp4826 Yes, that's true. This was an Old Custom SSO Auth, which basically derived from the Servlet definition in the web.xml customization.
So the very first login screen would be the login screen of our Enterprise Identity Provider aka ADFS.
In your cause, I would consider all my logic derived from Post Processing activity, however, use a declare trigger or some logic to update the Operator Timezone in case of change.
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/2023-06/73f362c8-b832-40d3-925c-157022b712a7.jpg?h=57870c3e&itok=F1Dfwfd6)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/2023-06/73f362c8-b832-40d3-925c-157022b712a7.jpg?h=57870c3e&itok=F1Dfwfd6)
Ford Motor Company
US
@pradeepp4826 Regarding SSO, Once the Authentication is completed, you can write a Post Processing Activity to derive the Timezone.
-
Raju Botu