Skip to main content


 

Symptoms


When selecting a date from a calendar control (set to only display date) on a custom SmartForm, then submitting the form to save the data, the associated SharePoint list displays the date previous to the date selected (e.g., 9/30/2015 chosen in the calendar control will show on the list as 9/29/2015).
 

Diagnoses


A difference in the time zone where the developer resides versus the set value for the SharePoint time zone is causing the date-only calendar control value to convert the stored data point to the previous date. To understand why, it is important to note that a calendar control on a SmartForm will display the local computer time, unless a rule is set up to pass the SharePoint Time Zone into the "Display Time Zone" property of the calendar control.

On an auto-generated view/form (based off of a list with a date column), a hidden data label is put on the list named "SharePoint Time Zone Text Box." On the initialize method of the view, a SmartObject method call from the list's associated SmO (the 'Get SharePoint Time Zone' method) is called and passed to this hidden data label. A rule then fires off when the data label changes that passes the data label's value into the "Display Time Zone" property of each calendar control on the form. All of this is set up by default when the view is auto-generated.

The calendar controls in question (with the incorrect display value) did not have these rules set up they needed to be created manually.
 

Resolution

Put a data label control on the view with the "visible" property unchecked so it would be hidden. Opened the Initialize rule of the view and added an "Execute a SmartObject method" action, firing off the "Get SharePoint Time Zone" method and outputting the SharePoint Time Zone to the hidden data label. Then created a rule that executes when the hidden data label is changed, passing its value to the "Display Time Zone" property of each calendar control.

Note: This issue will only be noticeable if the user of the form is doing so in a time zone that has a positive difference to the set value of the SharePoint time zone. It is good practice to include these rules explained in the resolution if any date/time values will be incorporated into the design of the form.




 

I am having this exact issue at my client.  I can get the SharePoint time zone to populate my hidden field as detailed but when I try to add this rule: "Then created a rule that executes when the hidden data label is changed, passing its value to the "Display Time Zone" property of each calendar control." I am unsure how to transfer the hidden date field to the Display Time Zone property?  When I use the transfer data option and click configure, I don't see any options to map to the calendar display time zone.  Please advise.

Thanks,

Christa


Reply