Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
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,962 Moderator 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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,558 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,647 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans