Data mirroring

JobW
Member Posts: 2
Good afternoon,
I'll give it a try whilst I am having troubles finding simple tutorials or look-a-like projects.
Our company is using: NAV 2009 R2
I have limited access (only object designer) due to license.
I am trying to write code behind a report.
I would like that once the report is ran, it mirrors delivery weeks (Company A master) between two companies.
The No.'s in sales headers are matching.
Company A
Sales Header No. 00001 - delivery week 30
Sales Header No. 00002 - delivery week 28
Company B
Sales Header No. 00001 - delivery week 24 (should be updated by report to 30)
Sales Header No. 00002 - delivery week 25 (should be updated by report to 28)
I've checked CHANGECOMPANY, but mostly it is people warning of usage.
Can someone give me a little push in the right direction?
I'll give it a try whilst I am having troubles finding simple tutorials or look-a-like projects.
Our company is using: NAV 2009 R2
I have limited access (only object designer) due to license.
I am trying to write code behind a report.
I would like that once the report is ran, it mirrors delivery weeks (Company A master) between two companies.
The No.'s in sales headers are matching.
Company A
Sales Header No. 00001 - delivery week 30
Sales Header No. 00002 - delivery week 28
Company B
Sales Header No. 00001 - delivery week 24 (should be updated by report to 30)
Sales Header No. 00002 - delivery week 25 (should be updated by report to 28)
I've checked CHANGECOMPANY, but mostly it is people warning of usage.
Can someone give me a little push in the right direction?
0
Answers
-
Hi!
CHANGECOMPANY can be dangerous if used in wrong ways, but if you know what you're doing, and it's used under a controlled scenario, I don't see issues with using it.
What is the use case here? Is Company B a copy of Company A? How can you guarantee that Sales Orders in Company B are the same as the ones in Company A?
These are initial questions that come to my mind when I take a look at your initial design.Marcelo Borges
D365 Business Central Solutions Architect
BC AL/NAV C/AL Developer
BC Repositories.com0 -
Hi,
Thanks for your reply.
Company B is a copy of Company A (main)
I can guarantee that the sales order is always the same.
Our system mirrors the sales orders from Company A into B.
The use case is:
As shared in my first message, it happens that a delivery week is changed in company A. Unfortunately there is no working functionality/code that updates also the delivery week in Company B. This is what I would like to achieve.
My first thought would be to run a report with this code behind it, let say in a job queue at the end of the day or for example manually ran for specific orders.
Company A
Sales Header No. 00001 - delivery week 30
Sales Header No. 00002 - delivery week 28
Company B
Sales Header No. 00001 - delivery week 24 (should be updated by report to 30)
Sales Header No. 00002 - delivery week 25 (should be updated by report to 28)
0 -
Hi
You need to know that CHANGECOMPANY only changes the source for this record's tabledata. If you validate any field, the validation code will validate its tablerelation against the current company's data, and any record variable that is used in the validation code references the current company's data.
Therefore you should not alter anything that requires validation in the record you called CHANGECOMPANY on, unless you know it is save.
Everything is ok, if you read data. so, for your business case, consider pulling data from company B, rather than pushing it from company A.
In your case, I guess the shipment week is somehow linked to the "Shipment Date". This again will be synchronized from header to lines. Therefor it is unlikely you will be able to do this from company A.
Other possible solutions:
- create a web service and call the service from company A in company B
- if STARTSESSION is available in 2009, you can use it to run a background session from company A in company B
- use the Job Queue in Company B to do the work. This job may scan documents in company A using CHANGECOMPANY, or use a staging table which you populate from company A with or without CHANGECOMPANY to company B.
I did not understand what you meant byI have limited access (only object designer) due to license.
1
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