Advertisements

Archive

Archive for September 14, 2011

Read Optionset value in Plugin CRM 2011

September 14, 2011 7 comments

Hi,

  Below is the sample code to read Picklist value (i.e., OptionSet Value) in CRM 2011

if (context.InputParameters.Contains(“Target”) && context.InputParameters[“Target”] isEntity)

{

currEntity = (Entity)context.InputParameters[“Target”];

}

int statusValue = -1;

string statusText=string.empty;

if (currEntity .Attributes.Contains(“statecode”))

{

OptionSetValue optionState = currEntity .Attributes[“statecode”] as OptionSetValue;

statusValue = optionTimesheetState.Value;

statusText = optionTimesheetState.Text;

}

Hope it helps 🙂

Advertisements