SELECT distinct e.LogicalName as entity, smState.Value AS [State/StateCode], smstate.AttributeValue as stateCode, smStatus.Value AS [statusReason/statusCode], smStatus.AttributeValue as statusCode 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.IsCustomEntity = 0 and e.LogicalName in ('lead','account','contact','opportunity') ORDER BY e.LogicalName, smState.AttributeValue, smStatus.AttributeValue; |
No comments:
Post a Comment
Remember, if you want me to respond to your comment, then you need to use a Google/OpenID account to leave the comment.