web
You’re offline. This is a read only version of the page.
close
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 363

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()?


I have the same question (0)
  • Suggested answer
    meelamri Profile Picture
    13,216 User Group Leader on at

    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.

  • Joel D Profile Picture
    363 on at

    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

  • Verified answer
    meelamri Profile Picture
    13,216 User Group Leader on at

    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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 60 Most Valuable Professional

#2
#ManoVerse Profile Picture

#ManoVerse 51

#3
Satyam Prakash Profile Picture

Satyam Prakash 42

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans