Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

update csucase status

Posted on by Microsoft Employee

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);


}

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,964 Super User 2024 Season 1 on at
    RE: update csucase status

    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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans