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

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Table storing mapping of State and Status Reason

(0) ShareShare
ReportReport
Posted on by

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

I have the same question (0)
  • Suggested answer
    Raj Rao Profile Picture
    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
    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
    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
    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
    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
    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
    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

Responsible AI policies

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

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Aric Levin - MVP Profile Picture

Aric Levin - MVP 2 Moderator

#2
MA-04060624-0 Profile Picture

MA-04060624-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans