Adding a new lookup field with a TableRelation to CRM Integration Table

xHorizonxHorizon Member Posts: 5
Hello,

I wanted to ask if anyone can explain to me how you properly add fields that have a table relation in business central for example "Sell-to Customer No." in "Sales Header" to a CRM Integration table, so that when the value of the lookup value in Business Central will properly be transfered to CRM and in CRM the correct value is displayed in the "lookup" field.
I was told that custom lookup fields tend to not work properly and thats why we avoided using them and instead we always opted to an additional field that has the flat value of the business central field and was typically of type "String" and our CRM team did fill the lookup value by using a plugin with the provided flat value of the integration table.

For the next integration table extension I wanted to try it without the need of an additional "flat" string field.
So I looked up how Microsoft is doing it for the table "CRM Invoice" I looked up how Microsoft is mapping the "Sell-to Customer No." field to the integration table, and they simply map the "Sell-to Customer No." -> "CustomerId" field of the integration table, the integration table has then the TableRelation set to the "CRM Account".AccountId field, although I'm not quite sure if the TableRelation is really needed for the integration part or just to verfiy data integrity when the records are synced.

So lets assume I have already extended my "Sales Header" table with a custom field "Object No." which then has a table relation to a custom table "Object" which has the fields "No." and "Description" for simplicity I will leave out the full fledged table definition.
And we assume that I already have an custom integration table (CRM Objects) that is already syncing records between Business Central and CRM so from BC Table "Object" -> "CRM Objects", and the CRM tables primary key field is "ObjectId".
Now I also want to sync the field "Object No." of my extended "Sales Header" so I proceed to create a new table extension for the table "CRM Invoice" and in CRM the field is of type "lookup (search)" do I have to create the field as a Guid field and specify a table relation to the custom table "CRM Objects".ObjectId, for it to work properly in CRM?
Because that is essentially whats Microsoft is doing with their fields that tradionally have "Code" primary keys in Business Central but in CRM you typically would have an GUID primary key.


And another thing I saw is that Microsoft on their own table integations is often times defining a "Dependency Filter" where they specify what would be I guess is entity names of CRM tables?
For example on the CRM Invoice table mapping they defined a dependency filter of "CUSTOMER|ITEM-PRODUCT|RESOURCE-PRODUCT|OPPORTUNITY" is this dependency filter also needed when you want to provide custom lookup fields in the integration table?
So for example if I wanted to sync my new extension field would I have to append to the dependency filter "CUSTOMER|ITEM-PRODUCT|RESOURCE-PRODUCT|OPPORTUNITY|OBJECT" or is this not necessary?

Thanks in advance
Sign In or Register to comment.