EONE  BLOG

Tech Tuesday: Working with Date and Time Fields in Integration between Microsoft Dynamics CRM and Microsoft Dynamics GP using SmartConnect


Today’s Tech Tuesday article comes right from the trenches of working in the world of integration. In this article we are going to focus on date fields from Microsoft Dynamics CRM.

Oftentimes when customers need to transform date fields from one format to another they will just use the standard SmartConnect Date Calculation (under Additional Fields in the mapping).


This will normally allow you to transform a date field from any format to any format. In the case of this specific customer we ran into two unique issues.

1) The first hurdle was that sometimes the date field coming from Microsoft Dynamics CRM would be NULL. This presents challenges as you have to make assumptions on how you handle NULLS. 

2) The second challenge was that we had multiple regions involved. In this specific example, we had Microsoft Dynamics CRM Online (hosted in a US locale) and Microsoft Dynamics GP on premise in the UK.

This customer had a Dynamics GP field that needed that date value along with another Extender window that needed the date value. What we were able to do to accomplish this task was to provide a calculated field to meet the criteria for both scenarios. Here is the calculated field that was used below in VB.NET form:

‘Use the date field from your CRM Entity below
Dim dateString as string = _CUSTOMENTITY_STARTDATE 
Dim provider as System.Globalization.CultureInfo = System.Globalization.CultureInfo.InvariantCulture
‘substitute the “en-US” below with the locale of the source data
Provider = New System.Globalization.CultureInfo(“en-US”)
 
‘Handle NULL/Blank value of date/datetime field 
if dateString =”” then
     return “1900-01-01”
else
     ‘Convert the datestring provided to a date field in locale, then convert to desired locale
     return (Convert.ToDateTime(dateString,provider)).ToString(“yyyy-MM-dd”)

end if
 
In this script we are using an interesting .NET feature. The CultureInfo class allows us to determine the locale of the date format. This in turn can be used to convert the dateString from Microsoft Dynamics CRM to the format of any locale. In our specific example we converted a US format date into the format that most of the world uses (in this specific instance, the UK). Additionally, we simply indicated that a blank value would return a standard date in the format that Microsoft Dynamics GP likes.
This script could be used to change any date/datetime field into a format suitable for Microsoft Dynamics CRM or Microsoft Dynamics GP.
 
Hope this helps you with any date calculation issues you may be trying to solve.
 
Thanks,
Chris Dew

Want more information on SmartConnect and the features it offers? Please contact sales@eonesolutions.com for more information!

2 Comments

  1. jake george on May 12, 2014 at 3:32 am

    Electromechanical Systems
    http://www.21cssindia.com/courses/micro-dynamics-online-training-111.html
    Electro mechanics; Electrostatics, Magneto statics, Induction, Maxwell’s Equations, Dielectrics, Ferromagnetism, Electromagnetic Energy, Electromechanical Transduction
    Electric Machines: Permanent Magnetic DC Motor, Variable Reluctance and Permanent Magnetic Stepper Motors,

  2. jake george on August 26, 2014 at 1:12 am

    micro dynamics online training| micro dynamics training| call …
    http://www.21cssindia.com/courses/micro-dynamics-online-training-111.html
    Micro Dynamics Online Training, Micro Dynamics training, Micro Dynamics course contents, Micro Dynamics , call us: +919000444287 …
    Call Us +919000444287 or contact@21cssindia.com

Leave a Comment




RECENT POSTS


Modify Excel Templates for compatibility with Excel Add-in
Meet eOne at Summit in Nashville
New Releases of SmartList Builder and Extender
VIP Roundup Party at Summit 2017 in Nashville
Tech Tuesday: Troubleshooting SmartList Builder Lists that Return No Data

POPULAR POSTS


2016 SmartConnect Integration Bootcamps
Tech Tues: Automatically refreshing Pivot Tables in Excel Refreshable Reports
Happy Thanksgiving from the eOne team!
New Releases of Extender and SmartList Builder
SmartList Builder 2013 New Feature of the Day: Auto Updating SmartList

CATEGORIES

ARCHIVES

open all | close all

TAGS

#fargo 2017 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 GP GPUG integration integration manager Meet the Team Microsoft Microsoft dynamics crm Microsoft Dynamics GP ODBC Office Relationships partners release SalesForce SalesForce.com scripting SmartConnect 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.