Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum
Answered

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

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
    meelamri 13,198 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
    Joel D 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
    meelamri 13,198 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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,570 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,683 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans