HELP ARTICLE

Wrong Date in Dynamics CRM/D365 for Customer Engagement Data Source


If you have ever needed to pull a time field from Dynamics CRM, the chances are the time shown in SmartConnect does not match the value seen in the CRM web client. There is a reason for this discrepancy, and in this article we will discuss how to use a calculated column to convert the time to the correct value.

Cause

SmartConnect uses the D365 web services to pull your data source. The web services return datetime fields exactly as they are stored in the D365 SQL tables. There are four ways datetime fields are stored.

  • User Local: Date is stored in table as UTC and when a client pulls the date it is converted to the user’s local time zone.
  • Time-Zone Independent: The value is stored in the local format, and will be retrieved by all clients in the same format.
  • Date Only: Only the date is set, but the field will contain a time value of 12:00AM.
  • Time Only: Only the time value is set, but the field will use the current date.

The format that will be used to set the date are specified when creating the field in CRM.

Resolution

User Local

A Calculated Column can be used to convert the field to the correct value.

If _MSDYN_TIMEWINDOWSTART = "" then
return ""
else
Dim UTCdate as date = _MSDYN_TIMEWINDOWSTART
return UTCdate.ToLocalTime()
end if

 

Date Only

A Calculated Column can be used to return only the date.

If _MSDYN_TIMEWINDOWSTART = "" then
return ""
else
return Convert.ToDateTime(_MSDYN_TIMEWINDOWSTART).ToString("yyyy-MM-dd")
end if

 

Time Only

A Calculated Column can be used to return only Time value

'Time-Zone Independent
If _MSDYN_TIMEWINDOWSTART = "" then
return ""
else
return Convert.ToDateTime(_MSDYN_TIMEWINDOWSTART).ToString("hh:mm tt")
end if

'Time-Zone Dependant
If _MSDYN_TIMEWINDOWSTART = "" then
return ""
else
Dim UTCdate as date = _MSDYN_TIMEWINDOWSTART
return UTCdate.ToLocalTime().ToString("hh:mm tt")
end if

Resource

Microsoft article about date and time fields.

RECENT POSTS


RM Apply Detail SmartList Builder Template
The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement
GlobalFileName not populated when using in a script
NAV 2017 Error: Data object not provided
Accessing your SmartConnect.com environment after purchasing on behalf of your customer at the eOne Shop

POPULAR POSTS


Removed Part: /xl/vbaProject.bin part. (Visual Basic for Applications (VBA))
Manufacturing Serial Trace SmartList Builder Template
The server process could not be started because the configured identity is incorrect.
How to update SmartConnect from 10.0.0.51 to SmartConnect 2014
Running a map in SmartConnect and receiving an error that says "The source was not found, but some or all event logs could not be searched."

CATEGORIES

ARCHIVES

open all | close all

TAGS

CRM Demo Dynamics Dynamics 365 dynamics crm Dynamics GP Dynamics NAV Econnect Employee Spotlight eone eOne News eOne Spotlight ERP Events Excel Excel Report Builder Extender Flexicoder GP GPUG integration integration manager Meet the Team Microsoft Microsoft dynamics crm Microsoft Dynamics GP Office Relationships partners release SalesForce SalesForce.com scripting SmartConnect SmartConnect.com SmartConnect Office Hours SmartList SmartList Builder SmartList Designer SmartView SQL Support Tech Tuesday Templates training Zendesk

Integrate & Automate without Any Code.

SmartList Data has Never Been Faster.

The Easiest Way to Report on GP Data.