Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Table storing mapping of State and Status Reason

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi CRM folks, which CRM table stores the mapping of case state and status reason? I would like to retrieve all the status reason under the Active state. I don't see the mapping in the table FilteredStringMap. Please help. Thanks.

*This post is locked for comments

  • Suggested answer
    Raj Rao Profile Picture
    Raj Rao on at
    RE: Table storing mapping of State and Status Reason

    Here is my answer on how you can get this data from CRM

    http://stackoverflow.com/a/43298544/44815

    SELECT distinct e.LogicalName as entity,
    	  smState.Value AS stateCode,
           smstate.AttributeValue,
           smStatus.Value AS [statuscode/statusreason],
           smStatus.AttributeValue
    FROM StatusMap sm
         JOIN Entity e ON sm.ObjectTypeCode = e.ObjectTypeCode
         JOIN StringMap smState ON smState.AttributeValue = sm.State
                                   AND smState.ObjectTypeCode = e.ObjectTypeCode
                                   AND smState.AttributeName = 'StateCode'
         JOIN StringMap smStatus ON smStatus.AttributeValue = sm.Status
                                    AND smStatus.ObjectTypeCode = e.ObjectTypeCode
                                    AND smStatus.AttributeName = 'StatusCode'
    WHERE  1=1 
    --and e.LogicalName in ('incident')
    ORDER BY e.LogicalName,
    	   smState.AttributeValue,
             smStatus.AttributeValue;

  • Verified answer
    PS Profile Picture
    PS 23,577 on at
    RE: Table storing mapping of State and Status Reason

    Hi ChernYee

    There is no separate table for status & status reason. These are stored under the specific record type tables for e.g. if you want the status reason for case entity, you can go to 'incident' table in SQL DB and search for statecode and statuscode. This will be dynamics as and when any value is added to these fields on case entity, until and unless you are hard coding it.

    For custom entities it would be active and inactive and for standard entities you can see it here technet.microsoft.com/.../dn531157.aspx

  • Suggested answer
    Tushar2016CRM Profile Picture
    Tushar2016CRM 1,130 on at
    RE: Table storing mapping of State and Status Reason

    hi

    StatusAttributeMetaData.OptionSet.Options hierarchy can return a type called StatusOptionMetadata if you use the State property of the StatusOptionMetadata, it will return the statecode this statuscode belongs to.

    Thanks

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Table storing mapping of State and Status Reason

    Thanks but I'm looking for the view or table in the database as I'm using SQL to query.

  • Suggested answer
    Tushar2016CRM Profile Picture
    Tushar2016CRM 1,130 on at
    RE: Table storing mapping of State and Status Reason

    Hi

    Please check the below link :

    stackoverflow.com/.../dynamics-crm-get-metadata-for-statuscode-statecode-mapping

    Thanks

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Table storing mapping of State and Status Reason

    Thanks, but I do not want to hardcode it. I would like to query it from the mapping table instead so that any newly added status reason will be reflected automatically.

  • Suggested answer
    Tushar2016CRM Profile Picture
    Tushar2016CRM 1,130 on at
    RE: Table storing mapping of State and Status Reason

    HI ,

    Please refer the below link for the mapping details :

    technet.microsoft.com/.../dn531157.aspx

    Thanks !

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans