Skip to main content

Notifications

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
    meelamri 13,204 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,204 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

News and Announcements

Announcing Category Subscriptions!

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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,359 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans