Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Problem while updating the entity

Posted on by 260

Hi,

I ihave an incident form in crm 2015.  After spme operations the incident entity becomes passive. In my database the passive incident is to be understood by  looking the state and status columns. If the incident is passive the statecode becomes 1 and the status code becomes 5.

After the incident becomes to be passive. I want to do someyhing to that incident entity.

As an operator i wanto to change the state and statu to activete the incident. (state=0,status=1)

If i success i wanto to update the new_anketgonderildi fielt (bit field) to true. Then make the incident again passive and update the entity.

But i got an error while updating the entity. 

update.jpg

"This case has already been resolved. Close and reopen the case record to see the updates."

I realized that if the incident is active i can change the new_anketgonderildi field. When the incident is in passive situation i can not change. To change the bit value field i have to activeta the incident cahneg the bit field and than deactiveate the incident again.

How can i achieve this situation? Can anyone help me please?

*This post is locked for comments

  • altun8tr Profile Picture
    altun8tr 260 on at
    RE: Problem while updating the entity

    Thank you Goutam. Your solutions solved my porblem. :-)

  • Verified answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Problem while updating the entity

    Hi ,

    Try with this  -

                    CloseIncidentRequest closeRequest = new CloseIncidentRequest();
                    Entity caseResolution = new Entity("incidentresolution");
                    caseResolution.Attributes.Add("incidentid", new EntityReference("incident", caseID));
                    caseResolution.Attributes.Add("subject", "Some text");
                    closeRequest.IncidentResolution = caseResolution;
                    closeRequest.Status = new OptionSetValue(statusReason); // provide status reason like 5
                    CloseIncidentResponse closeResponse = (CloseIncidentResponse)service.Execute(closeRequest);


  • altun8tr Profile Picture
    altun8tr 260 on at
    RE: Problem while updating the entity

    This error message gives inte second  resp = (SetStateResponse)CRM.crmLib.Execute(staterequest); to passive the incident.

  • altun8tr Profile Picture
    altun8tr 260 on at
    RE: Problem while updating the entity

    Hi Goutam, Thanks for you solution . It worked for me. But i need to passive the incident again. When i wanto to do this. It gives me "This message can not be used to set the state of incident to Closed.  In order to set state of incident to Closed, use the CloseIncidentRequest message instead."

    How can i solve this? please help me.

  • Verified answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Problem while updating the entity

    Hi ,

    Unfortunately , you can not directly update  the status by updating optionset value. You need to update using SetStateRequest  . Please have a look below code  .

                    SetStateRequest staterequest = new SetStateRequest();
                    //the entity you want to change the state of
                    staterequest.EntityMoniker = new EntityReference("incident", caseID);
                    //what should the new state be
                    staterequest.State = new OptionSetValue(stateCode);
                    //Pick an option from the status reason picklist to specify reason for state change
                    staterequest.Status = new OptionSetValue(statusReason);
                    SetStateResponse resp = (SetStateResponse)service.Execute(staterequest);



    Hope this helps.

  • altun8tr Profile Picture
    altun8tr 260 on at
    RE: Problem while updating the entity

    0827.update.jpg

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans