Hi all, I have a portlet and executing that portle...
# suitescript
d
Hi all, I have a portlet and executing that portlet on currentUser setting. The problem is I want to fetch current user’s timezone. I tried the following code however, I’m not getting the timezone of that currentUser who is executing the script. how can we achieve this? var userObj = runtime.getCurrentUser(); log.debug({title:‘user obj’,details:userObj}); var email = userObj.email; var emailString = email.split(‘@’); log.debug({title‘emailString’,detailsemailString}); var finalString = emailString[0]; var timeZone = userObj.location; log.debug({title‘timeZone’,detailstimeZone}); var subsidiaryObj = record.load({ type: record.Type.SUBSIDIARY, id: userObj.subsidiary, }); log.debug({title‘subsidiaryObj’,detailssubsidiaryObj}); var timezone = subsidiaryObj.TIMEZONE; log.debug({title‘timezone’,detailstimezone}); I get 0 (zero) in timezone variable.
1
b
that looks like an attempt to get the timezone of the user's subsidiary
d
yes correct
b
not really guaranteed to match the current user's timezone settings
are you trying to get the subsidiary's timezone, or the user's timezone
d
subsidiary’s timezone is also user’s timezone, so it’s one and the same
b
that assumption is not guaranteed correct
d
okay. then how can I pull current user’s timezone?
b
d
let me try that
yes it works. Thanks for correcting the concept.😅