Sep 24, 2010

Infopath Form picking date time from the client machine instead from the SharePoint Server

When using date time in InfoPath Forms, make sure you are aware of the fact that InfoPath 2007 is picking up the date time from the machine on which it's running i.e. clientt machine.

If the usage of the Infopath Forms (i.e. application) is in a single time zone then this might work well until and unless the client machine has the incorrect value set for date time.

Your application at certain time instances won't work properly if you have validations like date time greater then or less then current time and is being accessed by client located in the different time zones around the world.

To mitigate this issue, you need to write code behind in the page load function of infopath form. The code will basically pick the server time and store it with infopath form so that validations can be performed seamlessely regardless of the timezone of the client machine.

2 comments:

Anonymous said...

Hi,

I am working in Sharepoint application which is using Infopath forms.I have few date fields in Infopath form.Since the server located in U.S and this application was accessed by users who are in different work location in world , when comparing date it fails.
Example:-
If a user is in Austrailia and they are attempting to put in "today's" date (8/19/2011) which according to the server in U.S is greater than the system(Server) date in U.S (8/18/2011), the date validation is failing.
We are currently using formula today() in date field which is getting server machine time.To get the client machine time ,I used Javascipt code in formserver.aspx where able to get the client machine time but not able to bring into Infopath form.Please give some inputs.

celerity12 said...

If it's an extranet application then the user who is opening the form should have his profile updated in SharePoint based on his timezone.

Basically, you have to configure the user's profile in SharePoint

Pages