web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Get Label StateCode in StatusCode in Case (Incident)

(0) ShareShare
ReportReport
Posted on by 694

Hello everyone,

Asp.x have a page where I am displaying a gridview with data from the Case (Incident) created.

The Status Reason field in the select returns the Value example 100000000 and need to return the label such as "Complete".

Can anybody help me?

Thank you

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Felippe Profile Picture
    796 on at

    Hi Ricardo,

    If u are using the SDK to retrieve the Entity class, this code will retrieve the label of the desired OptionSet

    Example:

    incidentEntity.FormattedValues["statuscode"].ToString();

    If you are querying directly on the Views of CRM Organization, the view: "StatusMap" contains the value that you wants:

    string_5F00_map_5F00_2.png


    The column"AttributeValue"  corresponds to the OptionSet value(int).
    The column "Value" corresponds to the OpstionSet label value(varchar)
    The column "ObjectTypeCode" identify the EntityTypeCode. You can see the values of all entities in your CRM version here:
    https://msdn.microsoft.com/en-us/library/gg328086(v=crm.6).aspx

    Best Regards,
    Felippe Mendonça dos Santos


    If this helps, please Like and mark as "Suggested Answer"

  • Ricardo Rodrigues dos Santos Profile Picture
    694 on at

    Fellipe,

    Thanks for answering me.

    I am using a query that the loading of the page we fill in gridview,
    In this case I would have to do a join with the sitemap table?

    Below the query that I'm using, could auxliar me better please confess I do not quite understand.

    select customerid, customeridname , ticketnumber, new_equipamentoid, contactresponsible,title, statuscode, createdon from Incident" 

    Thank you for attention

  • Verified answer
    Felippe Profile Picture
    796 on at

    Yes Ricardo,

    You can make a "inner join" between incident and stringmap to return exaclty the information that you need.
    As follows:

    str_5F00_mp3.png

    Best Regards,
    Felippe Mendonça dos Santos


    If this helps, please "Like" and mark as "Suggested Answer"

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Varsha deshpande Profile Picture

Varsha deshpande 5

#2
JS-09031509-0 Profile Picture

JS-09031509-0 3

#3
Ciprian  P Profile Picture

Ciprian P 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans