Thursday, February 6, 2014

Update Emails to sent Status in CRM 2011

When working with emails in CRM most of the time we test with the email router being turned off. While this is good sometime we face an issue when we have to turn this on. We can either
  • Delete all the emails OR
  • Change the status of emails to Sent so that emails would not fire from Email router once we turn on the email router.


Most of the clients would prefer the second option as they would be able to keep the ones which have already being created. So how can we do this?
There is a simple database update which allows us to do this. After executing that you are good to go with email router turning on.
Status code = 3 (Sent)
State code = 1 (Completed)
Object Type Code = 4202 (Email Entity)


update ActivityPointerBase 
set StatusCode = 3,
StateCode = 1

where dbo.ActivityPointerBase.ActivityTypeCode = 4202

Retrieving Calendar of a Bookable Resource in Dynamics

There are occasions where we need to retrieve working days and working times of a resource in Dynamics grammatically. This is quite possible...