Thursday, September 18, 2014

Updating CRM database from external SQL table - Money and Time field update


attribute.Key.ToString()  -- is the CRM attribute name
row[attribute.Value]   -- The External SQL table value

For money
  if (attribute.Key.ToString() == "derivedproposaltotal" )
                               {
                                 
                                   decimal mymoney = Convert.ToDecimal(row[attribute.Value].ToString());
                                   entity[attribute.Key.ToString()] = new Money(mymoney);

                               }


For Time
   if (attribute.Key.ToString() == "derivedawarddate" )
                               {


                                   string mySourceString, myDateString;
                                   mySourceString = row[attribute.Value].ToString();
                                   myDateString = string.Concat(mySourceString.Substring(0, 10), "T", mySourceString.Substring(11, 8));
                                   entity[attribute.Key.ToString()] = DateTime.Parse(myDateString);

                                 
                               }

Wednesday, September 10, 2014

Bringing data from External System into CRM 2011

I am in the process of bringing data from External System into CRM 2011.
Updating  the CRM database from an external SQL table.
Using CRM SDK.