Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

SetStateRequest: what does OptionSetValue(1) and OptionSetValue(2) stand for?

(0) ShareShare
ReportReport
Posted on by 355

Hi,

I found the following piece of code, and I'm trying to find out what the int 1 and 2 (passed as parameters of OptionSetValue() ) stand for

var newRequest = new SetStateRequest();
var newEntityMoniker = newRequest.EntityMoniker();

newEntityMoniker = new EntiyReference()
{ 
   Id = myEntity.Id;
   LogicalName = myEntity.LogicalName;
}

newEntityMoniker.State = new OptionSetValue(1);
newEntityMoniker.Status = new OptionSetValue(2);

In this documentation, which explains the SetStateRequest class, I found an example of use of OptionSetValue but it doesn't use an int value as a parameter.

What does the instructions above mean, and where can I find some references about this usage of OptionSetValue()?


  • Verified answer
    meelamri Profile Picture
    13,216 User Group Leader on at
    RE: SetStateRequest: what does OptionSetValue(1) and OptionSetValue(2) stand for?

    Hi,

    The case of status remains an exceptional case. The labels/values can be found via the stringMap table. Indeed, this table contains the label/value choices. You will find on this link all default values of status/status reason: https://www.tpein.dk/?page_id=210

    For an ordinary option set field, you will be able to see the values of the options set, and you can also modify them: 

    pastedimage1626097026089v1.png

  • Joel D Profile Picture
    355 on at
    RE: SetStateRequest: what does OptionSetValue(1) and OptionSetValue(2) stand for?

    Hi Mehdi,

    Where can I find the labels for the Opportunity statecode field values?

    I opened the Status field properties for the Opportunity entity, but I onlu see these four labels: Auto, Inactive, active, disabled 

    OptionSetValue1.png

  • Suggested answer
    meelamri Profile Picture
    13,216 User Group Leader on at
    RE: SetStateRequest: what does OptionSetValue(1) and OptionSetValue(2) stand for?

    Hi Joel,

    A choice of an optionSet field is defined by a label + a value.

    For example, a "Won" opportunity is defined as: statecode field value of the opportunity is 1.

    Updating an optionset field means updating its value (a numeric) not its label.

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Adis Profile Picture

Adis 136 Super User 2025 Season 1

#2
Sohail Ahmed Profile Picture

Sohail Ahmed 81

#3
Jonas "Jones" Melgaard Profile Picture

Jonas "Jones" Melgaard 77 Super User 2025 Season 1

Product updates

Dynamics 365 release plans