Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Status Reason Values

Posted on by Microsoft Employee

Hi,

We are using ClickDimensions Events and created a unmanaged solution to change fields.

For the Status Reason (aka statuscode) field, we created scheduled (instead of Active) and Deactivated (Instead of Inactive) to avoid confusion among users since the Status (aka statecode) field also has Active/Inactive. However after deleting the Active/Inactive from Status Reason, we are now getting errors in the application and even in any events (ClickDimensions Entity) that had a reference to it.

Can't even access the Status Reason field to change it back.

6013.error.JPG

Is there a way to restore these status reasons Active/Inactive ?

*This post is locked for comments

  • Rawish Kumar Profile Picture
    Rawish Kumar 13,756 on at
    RE: Status Reason Values

    Glad it worked :)

    would you mind closing this thread then by marking suggestions as verified so that it can help others.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Status Reason Values

    Thanks Aric and Rawish.

    We created an unmanaged solution in the PROD (still out of the box) and just added the Events entity with the default Status Reason values and imported in our Sandbox. That seems to have somehow fixed the issue for now.

    Even though we were expecting to see Active/Inactive, it shows the customized values(Scheduled/Deactivated) but is working fine and we are able to open the field and also the events seem to be working fine.

  • Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Status Reason Values

    Not sure which entity this is for, but the default ones are Active (1), and Inactive (2). Usually they are not modified.

    If you need to change these after you fix the issue, I would just rename the existing ones.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Status Reason Values

    Thanks Aric,

    I came across another post that mentioned the same thing.

    The only issue remaining now is how to get the default values of the status codes we deleted.

    Will try 1 and 2 see if it works.

  • Suggested answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Status Reason Values

    That is most likely the problem, as the number (codes) for the Status Reasons are not incorrect and what is causing this issue. If you have the ability to reimport those fields (OOB) from a DEV environment that would be the best (as Rawish mentioned above).

    If not, you can possibly change the values of the existing fields (not sure what the original ones are) using the following code (in a C# console application):

           private void InsertStatusReasonValue(string entityLogicalName, int stateCode, int statusCode, string label)

           {

               InsertStatusValueRequest insertStatusValueRequest = new InsertStatusValueRequest

               {

                   AttributeLogicalName = "statuscode",

                   EntityLogicalName = entityLogicalName,

                   Label = new Label(label, 1033),

                   Value = statusCode, // integer value of current State Code

                   StateCode = stateCode // integer value of new Status Code

               };

               int _insertedStatusValue = ((InsertStatusValueResponse)service.Execute(insertStatusValueRequest)).NewOptionValue;

           }

    This way you can reset the status code to the correct value, but first you need to find out what they are.

    EDIT: One more thing. Your status codes are most likely Active = 1 and Inactive = 2, as these are the default values for most Status Reasons (codes)

    Hope this helps.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Status Reason Values

    You mean the unmanaged solution or the default one by MS ?

    We are configuring our sandbox environment.  That's where we deleted the status reason values.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Status Reason Values

    We created the new ones and deleted the existing ones.

  • Verified answer
    Rawish Kumar Profile Picture
    Rawish Kumar 13,756 on at
    RE: Status Reason Values

    Hi Gagandeep,

    is it possible for you to get a solution from other environment including this field and import it to this organization.

  • Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Status Reason Values

    Did you actually delete the Status Reasons or Rename (change the label) them?

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