Как присоединиться к dbo.LocalizedLabelView, чтобы получать метки форм в Dynamics CRM?

В Dynamics CRM я часто получаю от бизнес-пользователей требования по созданию отчетов. Бизнес-пользователи знают и говорят о отображаемых именах объектов и метках атрибутов . Чтобы написать запрос, мне нужно отобразить их на имена объектов и имена атрибутов . Я хотел бы использовать запрос, чтобы найти это.

К чему мне присоединиться к представлению dbo.LocalizedLabelView, чтобы получить столбец AttributeLabel в следующем запросе? Я не могу понять, на что должен ссылаться ObjectId. (И если вы расскажете, как вы ответили на этот вопрос, я был бы особенно признателен! )

select
    [EntityName]           = entityNames.Name,
    [EntityDisplayName]    = entityDisplayNames.Label,
    [AttributeName]        = attributeNames.PhysicalName,
    [AttributeDisplayName] = attributeDisplayNames.Label
    --[AttributeLabel]     = attributeLabels.Label
from 
    dbo.EntityView entityNames

    inner join dbo.LocalizedLabelView entityDisplayNames
        on entityDisplayNames.ObjectId = entityNames.EntityId
        and entityDisplayNames.ObjectColumnName = 'LocalizedName'

    left outer join dbo.AttributeView attributeNames
        on attributeNames.EntityID = entityNames.EntityID

    inner join dbo.LocalizedLabelView attributeDisplayNames
        on attributeDisplayNames.ObjectId = attributeNames.AttributeID
        and attributeDisplayNames.ObjectColumnName = 'DisplayName'
        and attributeDisplayNames.LanguageID = entityDisplayNames.LanguageID

    --inner join dbo.LocalizedLabelView attributeLabels
    --  on attributeLabels.ObjectId = ?????
    --  and attributeLabels.LanguageID = entityDisplayNames.LanguageID
where
    entityDisplayNames.LanguageID = 1033
order by
    entityDisplayNames.Label,
    attributeDisplayNames.Label
8
задан shytikov 9 September 2015 в 14:51
поделиться