AX Dynamics 2009 Multi Time zone Problem

This question is answered

Hi all,

Here i met a problem  that is multi time zone problem.

We have some sites which are US, Taiwan , Thai and Japan. End user will use the remote desk through VPN to access AOS server in Japan. But when these sites create SO/PO and post them to Journal , they have same date. Now we want to solve this problem to display date by each local date.

I tried to change the user opertions to set up the user time zone,it doesn't work.

And i tried to change the company information to specify the time zone for each company, it also doesn't work.

Anybody can share their experience with us?

Thank you very much.

Verified Answer
  • Hi Duke

    As write on the link community.dynamics.com/.../197112.aspx, If the user has a different time zone to the AOS, the timeNow() and systemDateGet() functions are returning the AOS details when the local date time is required.

    So, when you create a Sales Order the CreatedDatetime is correct, so following the User Timezone.

    BUT, for initialize the Picking list date or Packing Slip Date, etc., AX use the function systemDateGet(). This one return the AOS time zone.

    For e.g. look method transDate of SalesFormLetter class.

    At this point, in my opinion you have two solutions :

    1- Use the workaround suggest by Barry.

    2- As you already have, create one AOS for each time zone. Link the AX Users to the right AOS according their local Time Zone.

    The first one is mandatory if only 1 AOS is present.

    I hope now is more clear for you.

    Let me know any queries.

    Regards

    Thanks & Regards

    Denis Macchinetti

    Senior Technical Architect

All Replies
  • Not certain, but I think that to get the behaviour you want on AX2009 you will need one AOS per user time zone and use user config to control which AOS each user connects with.  

  • Thank you for your reply.

    Now each sites use one AOS. I searched that from AX dynamics 2009 , time zone can be set up as user level.

    But when i set up time zone for each user,date (requested date , delivery date and so on ) of SO/PO can't be changed as i set the time zone.

    Could you tell me the solution?

    Thank you very much.

  • Thank you for your reply.

    Now each sites use one AOS. I searched that from AX dynamics 2009 , time zone can be set up as user level.

    But when i set up time zone for each user,date (requested date , delivery date and so on ) of SO/PO can't be changed as i set the time zone.

    Could you tell me the solution?

    Thank you very much.

  • Hi

    Have a look at community.dynamics.com/.../197112.aspx

    What's do you mean for "But when i set up time zone for each user,date (requested date , delivery date and so on ) of SO/PO can't be changed as i set the time zone. " ?

    The date fields are disabled ?

    Thanks

    Regards

    Thanks & Regards

    Denis Macchinetti

    Senior Technical Architect

  • "But when i set up time zone for each user,date (requested date , delivery date and so on ) of SO/PO can't be changed as i set the time zone. "

    I mean that administrator->common form->user->user option, and then i set timezone for each user.

    When i log in system as i set up user, and create SO/PO ,the time still be the server time.

    I don't know how to set up .

    If you know , plz teach me.

    Thank you very much.

  • Hi

    On my local env, I have created a test Table with a UTCDateTime field and I have activated the CreatedDateTime property.

    First of all, I have set my time zone to "(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna".

    I have create one record on test Table and initialize the UTCDateTime field with the same value of CreatedDateTime field.

    Now I change the User time zone to "(GMT-03:00) Brasilia".

    I have browsed my test Table and both UTCDateTime and CreatedDateTime fields  had time with the right timezone so, 3 hours back.

    If this don't work for you, mean your environment have some bug.

    What's your Kernel Roll-up ?

    Regards

    Thanks & Regards

    Denis Macchinetti

    Senior Technical Architect

  • Hi Denis:

    Thank u for your reply.

    I'll test it. But I want to confirm one thing . Your created table in AOT?

    Sry, I am not the developer, I don't know the method that how to create table and link it to the table.

    And could you tell me what are there in this table?

    Thank you very much

  • Hi

    Yes, I have create a new table from AOT.

    However, you can test also creating an SO and check the CreatedDateTime field.

    You can do that from the Sales Order form, go to an header field, Right Click Record Info and choose Show all fields. Look at the bottom right side.

    Try to check the field before and after time zone changing.

    Let me know any other queries.

    Regards

    Thanks & Regards

    Denis Macchinetti

    Senior Technical Architect

  • Hi Denis,

    Thank you for your quick responce.

    I have 2 quesetions.

    1) Could you explan that what's the relationship between the new table and timezone?

       I mean that the new table how to control the display timezone?

    2) I did your method,but when i create SO -> Posting -> Picking list ,in here the "Picking list date" still the server time. The time didn't change to I set time. I don't know why.Please teach me.

    By the way , my Kernel version : 5.0.1500.6491

    Waiting your reply.

    Thanks

    Duke

  • Hi Denis:

    And also, when i create PO , the delivery date is server time.

    Of course,i set up user option->time zone(i.e Hawaii) for testing.The server time in Japan is Feb. 18, Hawaii should be Feb. 17. So when create PO , the delivery date, and SO Picking list date is still Feb. 18.But for SO , requested receipt date and Requested ship date are Feb. 17.

    Now i try it like above.

    Thank you .

    Duke

  • Hi Duke

    As write on the link community.dynamics.com/.../197112.aspx, If the user has a different time zone to the AOS, the timeNow() and systemDateGet() functions are returning the AOS details when the local date time is required.

    So, when you create a Sales Order the CreatedDatetime is correct, so following the User Timezone.

    BUT, for initialize the Picking list date or Packing Slip Date, etc., AX use the function systemDateGet(). This one return the AOS time zone.

    For e.g. look method transDate of SalesFormLetter class.

    At this point, in my opinion you have two solutions :

    1- Use the workaround suggest by Barry.

    2- As you already have, create one AOS for each time zone. Link the AX Users to the right AOS according their local Time Zone.

    The first one is mandatory if only 1 AOS is present.

    I hope now is more clear for you.

    Let me know any queries.

    Regards

    Thanks & Regards

    Denis Macchinetti

    Senior Technical Architect

  • Hi Denis:

    I tried to the method of Barry.And now i have 2 questions.

    Could you help me to slove it?

    1) I tried to coding the class.But ax always tell me the "Variable connection has not been declared".

       First i created new class , it called timezone1 and i wrote it like these.

    class timezone1{

      str                             sql;

      sqlStatementExecutePermission   perm;

      connection                      conn        = new UserConnection();

      timeZone                        timeZone;

      int                             ret;

     str connection;

    }

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

    Second, i created the function like these.

    static server void setSessionDateTime(utcDateTime reference = dateTimeUtil::utcNow())

    {

      connection                      conn        = new UserConnection();

      session                         session = new Session();

      ;

      if (session.clientKind() != clientType::WorkerThread)

      {

          timeZone = dateTimeUtil::getCompanyTimeZone();

          sql     = strfmt("Update userInfo set preferredTimeZone = %1 where userInfo.id = '%2'", enum2int(timeZone), curUserId());

          perm    = new SQLStatementExecutePermission(sql);

          perm.assert();

          ret = conn.createStatement().executeUpdate(sql);

          if (timeZone != dateTimeUtil::getUserPreferredTimeZone())

          {

              dateTimeUtil::setUserPreferredTimeZone(timeZone, true);

              dateTimeUtil::setSystemDateTime(reference);

          }

          CodeAccessPermission::revertAssert();

      }

    }

    2) I don't know the relationship between the test  table and these programe. Or maybe just the programe can solve the timezone problem?

    Above 2 quesetions please help me to fix them.

    Waiting your reply.

    Thank you very much.

    Duke

  • Hi Denis,

    I think i had already fixed the decleared problem.

    class timezone1{

    }

    static server void setSessionDateTime(utcDateTime reference = dateTimeUtil::utcNow())

    {

     str                             sql;

     sqlStatementExecutePermission   perm;

     connection                      conn        = new UserConnection();

     timeZone                        timeZone;

     int                             ret;

     connection                      conn        = new UserConnection();

     session                         session = new Session();

     ;

     if (session.clientKind() != clientType::WorkerThread)

     {

         timeZone = dateTimeUtil::getCompanyTimeZone();

         sql     = strfmt("Update userInfo set preferredTimeZone = %1 where userInfo.id = '%2'", enum2int(timeZone), curUserId());

         perm    = new SQLStatementExecutePermission(sql);

         perm.assert();

         ret = conn.createStatement().executeUpdate(sql);

         if (timeZone != dateTimeUtil::getUserPreferredTimeZone())

         {

             dateTimeUtil::setUserPreferredTimeZone(timeZone, true);

             dateTimeUtil::setSystemDateTime(reference);

         }

         CodeAccessPermission::revertAssert();

     }

    }

    And this is the final programe.And then i set up the user option for different timezone.

    And then i gone to test SO and PO.

    The delivery date of PO and Picking list date of SO didn't change. Same as server.

    I want to know that the relationship between the test table which you told me and this programe.

    Or the relationship between the programe and the date of SO/PO.

    Waiting your reply.

    Thank you very much.

    Duke

  • Hi Denis,

    I tried to find out userInfo table in AOT ->Data Dictionary -> Tables.But i didn't find out it.

    AX dynamics 2009 doesn't have the userInfo table ?

    Maybe my method is wrong i think.

    Could you tell me the answer?

    Thank you .

    Duke

  • Hy Duke

    The Userinfo table is located on System Documentation\Tables.

    Is a system table.

    During the day I'll try to find a window for give you an answer on the other questions.

    Regards

    Thanks & Regards

    Denis Macchinetti

    Senior Technical Architect