如何加入 dbo.LocalizedLabelView 来获取 Dynamics CRM 中的表单标签?

发布于 2024-10-19 11:49:51 字数 1456 浏览 3 评论 0原文

在 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

In Dynamics CRM, I often get requirements from business users to create reports. Business users know and speak about entity display names and attribute labels. To write a query, I need to map those to entity names and attribute names. I would like to use a query to look this up.

To what do I join the dbo.LocalizedLabelView view to get the AttributeLabel column in the following query? I can't figure out what ObjectId is supposed to reference. (And if you can tell me how you figured out the answer I'd be especially appreciative!)

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

遥远的她 2024-10-26 11:49:51

ObjectId 是对 CRM 数据库中事物的内部 ID 的引用。这个东西可以是属性、实体、标签等等。

由于您需要属性的标签,因此请在此处使用该属性的 id 作为 ObjectId。我认为您希望连接条件如下所示:

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

如果您想要属性的描述,可以将 ObjectColumnName 更改为“Description”。

ObjectId is a reference to the internal ID of a thing in the CRM database. This thing can be an attribute, entity, label, or whatever.

Since you want the label for your attribute, use that attribute's id as the ObjectId here. I think that you want your join condition to look like this:

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

If you want the description for the attribute, you can change the ObjectColumnName to 'Description'.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文