Issue with user import transform for time zone

Baggies
Kilo Guru

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.

--------------------------------------------------------------------------------------------------------------------------------

find_real_file.png

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;

}

1 ACCEPTED SOLUTION

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



 


View solution in original post

6 REPLIES 6

Michael Fry1
Kilo Patron

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");


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



 


Yes, I did have a missing ( - thanks!


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.