修改 Business Central 中的 TableRelation 属性

问题描述 投票:0回答:1

我正在尝试修改 BC 中标准字段的 TableRelation 属性,但没有成功。 尽管我做了很多尝试,但 Business Central 似乎没有察觉到我的修改。

对于这个问题你有什么可能的解决方案吗?

我尝试替换该属性的整个标准逻辑,但没有成功。 我尝试扩展该属性,使用 TableExtension 向字段添加一些过滤器,但没有成功。

microsoft-dynamics dynamics-business-central dynamics-365-sales businesscentral dynamics-365-ce-onpremises
1个回答
0
投票

无法无限制地扩展表字段 TableRelation 属性。我们必须添加基于条件的链接,如下所示:

// Table field of table
field(3; Relation; Code[20])
{
  TableRelation =
    if (Type = const (Customer)) Customer
    else if (Type = const (Item)) Item;
}

// modify the table field via extension
modify(Relation)
{
    TableRelation = if (Type = const (Resource)) Resource;
}

组合表关系是自上而下评估的。这意味着 第一个无条件关系将占上风,这意味着你不能 将现有的 TableRelation 从 Customer 更改为 Item,因为 原表关系是无条件的。

来源:https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/properties/devenv-tablerelation-property

© www.soinside.com 2019 - 2024. All rights reserved.