Synchronizing contacts between companies

grefu
Member Posts: 3
Hi.
I'm working in a company which has 7 companies inside Dynamics NAV. Most of them are only using accounting module. They've just created a new company which it's going to work with a own module based on contacts module. As they need to work with contacts already created in the "master" company, I need to share them between companies.
I thought about using "DataPerCompany" property but I read about many problems that might occur. Then I look into about how to synchronize companies and I found the code below:
I'm not pretty sure that how to use this because contacts can be created by standard Contacts Form or with a Form from that own development, which uses .INSERT and .VALIDATE methods. Then, must I use this code in OnInsert trigger? in OnValidate trigger? In both?
Regards.
I'm working in a company which has 7 companies inside Dynamics NAV. Most of them are only using accounting module. They've just created a new company which it's going to work with a own module based on contacts module. As they need to work with contacts already created in the "master" company, I need to share them between companies.
I thought about using "DataPerCompany" property but I read about many problems that might occur. Then I look into about how to synchronize companies and I found the code below:
Comp.FIND('-'); REPEAT IF Comp.Name <> COMPANYNAME THEN BEGIN Item2.CHANGECOMPANY(Comp.Name); Item2.COPY(Item); If not Item2.insert THEN Item2.MODIFY; END; UNTIL Comp.NEXT = 0;where "comp" is a record from 2000000006 table "Company"
I'm not pretty sure that how to use this because contacts can be created by standard Contacts Form or with a Form from that own development, which uses .INSERT and .VALIDATE methods. Then, must I use this code in OnInsert trigger? in OnValidate trigger? In both?
Regards.
0
Comments
-
Hi,
Everybody seems to be afraid of 'shared tables' .... I use it a lot and I would recommend it in this case too.
I use very often within 1 database with plural companies the tables Vendor, Customer, Item as 'Shared tables'. All ledger entry tables should NOT be shared. It works....
I would do this with "contact' too.... I do not see any major problem.
Saluti RaymondSimple is simply the best0 -
Thank you. But how many tables are affected by this change? I mean, that If I change "DataPerCompany" in Contact table, I'll have to change Vendor, Client, etc.. too, haven't I?0
-
The reason many people dislike using the DataPerCompany for existing tables is quite simple:
Unless you include all related tables you're gonna end up with problems sooner or later.
Also, consider the situation where you've set DataPerCompany=No for the Customer table (or another table with related ledger entries). If you delete the Customer in one of your companies, you could be left with orphaned ledger entries in another -> one hell of a mess.Brian Rocatis
Senior NAV Developer
Elbek & Vejrup0 -
The reason many people dislike using the DataPerCompany for existing tables is quite simple:
Unless you include all related tables you're gonna end up with problems sooner or later.
Also, consider the situation where you've set DataPerCompany=No for the Customer table (or another table with related ledger entries). If you delete the Customer in one of your companies, you could be left with orphaned ledger entries in another -> one hell of a mess.Brian Rocatis
Senior NAV Developer
Elbek & Vejrup0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions