Wednesday, May 29, 2013
Working with Date and Time Values in CRM 2011 Programmatically
Most of us working with CRM 2011 would have faced some issues working with CRM 2011 date time objects as they don’t represent the exact date time value that we see on CRM form.
This has been an issue when working with the programmatically as what we see as the date time value in the CRM form isn’t the value that is stored in the database for that field. The value we send gets converted and gets stored inside the date time field. When we check the record from CRM form, internally this value has got converted and we see the correct value. This is all good. But what happens when you want to get this field programmatically for one of our task. This is where we get the issue.
We came across an issue like this while working with one of our projects. We came up with the following solution to get around this issue.
· We retrieve the user setting of the user who created the record.
· Then we take the TimeZoneBias and TimeZoneDaylightBias fiels values from the user setting record and calculate the correct time from them.
UserSettings us = "Retreived user settings record";
DateTime dt = account.start_date.Value.AddMinutes(-Convert.ToDouble(us.TimeZoneBias));
dt = dt.AddMinutes(-Convert.ToDouble(us.TimeZoneDaylightBias));
The value is normally updated in the database in the CRM by adding users time zone minutes and deducting the day light saving value. We simply add them here to get the correct date and time. Simple ha!.....
at May 29, 2013
There are occasions where we need to retrieve working days and working times of a resource in Dynamics grammatically. This is quite possible...
There is a bit of change in CRM 2011 than CRM 4. The code is below. Microsoft.Xrm.Sdk. EntityReference Moniker1 = new Microsoft.Xrm.S...
When you create a new security role from scratch and then assign only that role to a system user and when you log to the CRM site you might ...
Error message “User does not have send-as privilege.” when sending emails programmatically in CRM 2011We were working on sending emails programmatically using CRM and all were working fine. Suddenly we got this error when we tried to send an ...