web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

update csucase status

(0) ShareShare
ReportReport
Posted on by

hi does anyknow what wrong with this code its still not update casestatus (casestatus is mul choice)

try
{
trace.Trace("inside try");
//obtain the target entity from the inputparameter
Entity target = (Entity)context.InputParameters["Target"];
//rettrive
trace.Trace("retrieve task");
Entity entity = service.Retrieve("task", target.Id, new ColumnSet(true));

EntityReference regardingCaseRef = entity["regardingobjectid"] as EntityReference;
//retrive regarding from the back end
trace.Trace("2");
Entity regardingCase = service.Retrieve(regardingCaseRef.LogicalName, regardingCaseRef.Id, new ColumnSet(true));
//retrieve entityrecord from the ms crm server that match the
trace.Trace("4");
QueryExpression qeRelatedTasks = new QueryExpression("task");
qeRelatedTasks.ColumnSet = new ColumnSet(true);
qeRelatedTasks.Criteria.AddCondition(new ConditionExpression("regardingobjectid", ConditionOperator.Equal, regardingCaseRef.Id));
EntityCollection relatedTasks = service.RetrieveMultiple(qeRelatedTasks);
trace.Trace("check bool");
if (AllTaskReject(relatedTasks))
{

trace.Trace("status check");
// regardingCase["cos_csucasestatus"] = new OptionSetValue(769190006);
 regardingCase.Attributes["cos_csucasestatus"] = new OptionSetValue(769190006);

 service.Update(regardingCase);


}

I have the same question (0)
  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    You need to use below code to set multi choice optionset field

    OptionSetValueCollection collectionOptionSetValues = new OptionSetValueCollection();

    OptionSetValue optionSet = new OptionSetValue(optionsetValue);

    collectionOptionSetValues.Add(optionSet);

    entityAccount["new_multioption"] = collectionOptionSetValues;

    _service.Update(entityAccount);

    www.inogic.com/.../

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 170 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 61

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 52 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans