Hi All,
I have a requirement where i have to retrieve Multi OptionSet Values and set it on a text field using c# code.
Below is the code but i am getting error like invalid logic
ColumnSet cs = new ColumnSet("bmw_webmembership");
Entity processes = (Entity)organizationService.Retrieve(targetEntity.LogicalName,targetEntity.Id,cs);
string text = string.Empty;
OptionSetValueCollection webmembership = (OptionSetValueCollection) targetEntity.GetAttributeValue<OptionSetValueCollection>(Contact.Fields.bmw_webmembership);
foreach (OptionSetValue OSV in webmembership)
{
text = text + OSV.Value.ToString() + ",";
}
bmw_log blog = new bmw_log();
blog.bmw_ReasonText = "Entity:" + processes.LogicalName + "Value:" + processes.Attributes["bmw_webmembership"];
organizationService.Create(blog);
Entity contact = new Entity("contact");
contact.Attributes["bmw_webmemberstext"] = text;
organizationService.Update(contact);
Urgent Help is required.
*This post is locked for comments