- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2016 04:35 PM
We have a scheduled import, that imports user data from AD, whose source is SAP. The user timezone in the source, is set to MST, CST, EST etc. But this is causing us some issues with the time displayed for users and the records they create.
I would like to add a Transform Scrip to the Import to convert the Time Zones like below. Also, I havent tried this in the script below, but if the source is empty, can I use a javascript to set it to the system default?
Am I going about this the right way, or is there an easier alternative such as a BR? I appreciate (as always) any feedback.
Mark S.
--------------------------------------------------------------------------------------------------------------------------------
Header 1 |
---|
//convert time zones if (source.u_timezone == "MST"){ target.setDisplayValue('time_zone',"Canada/Mountain"); } if (source.u_timezone == "EST"){ target.setDisplayValue('time_zone',"Canada/Eastern"); } if (source.u_timezone == "PST"){ target.setDisplayValue('time_zone',"Canada/Pacific"); } if (source.u_timezone == "CET"){ target.setDisplayValue('time_zone',"Canada/Pacific"); } else if (source.u_timezone == ""){
ignore = true; } |
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2016 08:41 PM
Hello Michael, thanks for the reply. I think there may be a missing bracket from your solution. So to clarify, would:
if (source.u_timezone == "MST"){
target.setDisplayValue('time_zone',"Canada/Mountain");
become
if (source.u_timezone == "MST"){
target.time_zone == "Canada/Mountain";
or (as in your response) which has a closing ' ) ' , but no opening ' ( '.
if (source.u_timezone == "MST"){
target.time_zone == "Canada/Mountain");
Cheers, Mark S

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2016 07:07 PM
Your going the right way but doing it in the Transform Map. But you can just set the value, versus using setDisplayValue.
if (source.u_timezone == "MST"){
target.setDisplayValue('time_zone',"Canada/Mountain");
should just be
if (source.u_timezone == "MST"){
target.time_zone == "Canada/Mountain");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2016 08:41 PM
Hello Michael, thanks for the reply. I think there may be a missing bracket from your solution. So to clarify, would:
if (source.u_timezone == "MST"){
target.setDisplayValue('time_zone',"Canada/Mountain");
become
if (source.u_timezone == "MST"){
target.time_zone == "Canada/Mountain";
or (as in your response) which has a closing ' ) ' , but no opening ' ( '.
if (source.u_timezone == "MST"){
target.time_zone == "Canada/Mountain");
Cheers, Mark S

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2016 05:09 AM
Yes, I did have a missing ( - thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2016 08:10 AM
Thanks MIchael, I think it was a lag in my browser last night causing me issues. Appreciate your help, have a good one. I'll post my results too.
Mark S.