最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

Get rid of BP:839 Only foreign key constraints are allowed on this table

网络文摘 William 2005浏览 0评论

If your create a conditional relation including a fixed field and normal relation you will get a best practice error 839 telling you Only foreign key constraints are allowed on this table.

Dynamics Ax 2012 Best Practice Error 839

However such relations are used e.g. in the PriceDiscTable where no such BP:829 error is show. The table compiles without any best practice errors.

No Best Practice Error 839 in PriceDiscTable

Exporting both tables to an XPO and comparing them reveals that a there is a flag EnforceFKRelation which is set to 0 at the PriceDiscTable and 1 to all other newly created tables in Dynamics AX.

Comparing PriceDiscTable XPO

However, you cannot set this flag in the property dialog in AX. As it is not a property of the table itself, it does not even appear in the TreeNode.AOTgetProperties() list.

Exportfile for AOT version 1.0 or later
Formatversion: 1

***Element: DBT

; Microsoft Dynamics AX Table : PriceDiscTable unloaded
; —————————————————————————
  TABLEVERSION 1
 
  TABLE #PriceDiscTable
    EnforceFKRelation 0
    PROPERTIES
      Name                #PriceDiscTable
      Label               #@SYS5926

As Martin already posted, this issue can be addressed changing the value by hand in the XPO. However, this approach works only if the modified table was deleted before (re-)importing it to the AOT. Use the SQL Server Export / Import Data Tool to save your data e.g. to a flat file and import it afterwards. Moreover, if the flag is set to 0 in the XPO it is also advised not to use SurrogateKeys as Primary Key and Cluster Key anymore. Otherwise you will get minor import errors.

BP Error 839 is gone


发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址