Friday, 22 January 2016

11:37 - No comments

Retrieve Fields Values Using Late Bound In Microsoft Dynamics CRM 2011

Code:
//Get the record of the “Account” entity.
Entity _Account = OrganizationService.Retrieve(“account”, new Guid(“recordguid”), new ColumnSet(){AllColumns=true});
//To get string value
string Name = _Account[“name”].ToString();
//To get Option Set selected value
int OptionSetValue = ((OptionSetValue)_Account[“accountcategorycode”]).Value;
//To get  Option Set selected text
String  OptionSetTest = ((OptionSetValue)_Account.FormattedValue[“accountcategorycode”]).Value;
//To get  date time field value
DateTime CollectionDate = ((DateTime)_Account[“new_collectiondate”]).Date;
//To get  money field value
decimal Creditlimit = ((Money)_Account[“creditlimit”]).Value;
//To fetch decimal field value
decimal Executivecommission = (decimal)_Account[“new_executivecommission”];

0 comments:

Post a Comment