knowledgecenter-breadcrum

Knowledge Center

15 Jul, 2026

Recovering a Deleted Option Set(Choice) Value in Dynamics 365 Using Web API

Posted on 15 Jul, 2026 by Shoaib Khan, Posted in Microsoft Power Platform Power Apps Dataverse Power Platform Dynamics 365 Web Api Dynamics 365 Blog

Blogs

The Problem

Recently, we faced an interesting issue while working with the Status Reason (statuscode) field on the Contact table.

Our environments were configured as follows:

Development – Unmanaged
UAT – Managed

Unfortunately, someone accidentally deleted one of the Status Reason values from the Contact table in the Development environment.

Normally, you would think creating the option again would solve the problem. However, that's where the real challenge began.

 

Why Creating a New Status Reason Didn't Work

When you create a new Status Reason value from the Maker Portal or Solution Explorer:

  • Dataverse automatically assigns a new integer value.
  • You cannot manually specify the option value for some OOB Option set fields.
  • The deleted value cannot be recreated with its original numeric value.

For example:

Before Deletion  After Creating Again
Pending Verification = 3  Pending Verification = 800860001

This created a deployment problem.

The UAT managed solution was still expecting the original value (3), but Development now had a different value (800860001).

Changing the value manually isn't supported, and Dataverse doesn't provide a way to override the automatically assigned value.

At this point, we were stuck.

 

The Solution

After some research, we found that Dataverse exposes a Web API action called.

Unlike creating a Status Reason through the UI, this API allows you to specify the exact integer value for the Status Reason.

Using the XrmToolBox Web API Launcher, we called the following endpoint:

As shown below, the request completed successfully.

What Happened Next?

Once the Status Reason was recreated with the same value (3) in the Development environment:

  • We exported the managed solution.
  • Imported it into UAT.
  • The deployment completed successfully.
  • No duplicate Status Reason values were created.
  • No new integer values were generated.
  • The existing Status Reason in UAT continued to work correctly.

Because both environments now contained the same Status Reason value, the managed solution imported without any issues.

 

Comment

This is a Required Field

Loading

Recent Updates

Blogs
11 Aug, 2026

How to Remove an Unmanaged Layer from a Dataverse Email Template

Overview Email Templates in Microsoft Dataverse make it easy to reuse email content such as subject lines, message bodies, and…

READ MORE
How to Populate Dynamic Content Using Repeating Controls in a Word Document
Blogs
20 Jul, 2026

How to Populate Dynamic Content Using Repeating Controls in a Word Document

Introduction: Organizations frequently generate documents like invoices, certificates, quotations, transcripts, inspection reports etc. While single-value fields such as Name, Email,…

READ MORE
Blogs
25 Jun, 2026

Dynamics CRM Testing Checklist Before Production Deployment

There are certain things in a CRM project that a QA must validate or verify before any solutions gets deploy…

READ MORE