Insert Item from Company A into Company B
tompynation
Member Posts: 398
Hi,
I would like to achieve the following:
When there is an item Created in Company A, this item should also get Created automatically in Company B
Same when updating in Company A, the item in Company B should also be Updated...
How can i achieve this ?
I would like to achieve the following:
When there is an item Created in Company A, this item should also get Created automatically in Company B
Same when updating in Company A, the item in Company B should also be Updated...
How can i achieve this ?
0
Comments
-
-
How you mean ChangeCompany and then do your thing...
When i am in the OnModify function of the Item table (Comp. A), how will i know if the item exists in Comp. B ?
And how will i update it then, or if it doesnt exist insert in Comp. B0 -
Sorry, thought it was clear from the code.
Say you are in Company A. Item is a record from the Item table.
In OnInsert or OnModify you would need to do:
Item.CHANGECOMPANY(Company
;
IF NOT Item.GET("No.") THEN
Item.INSERT;
The CHANGECOMPANY function literally points that record variable to another company, so even though you may be operating in Company A, that record variable will only see records in the company you've changed to.
Is that more clear?0 -
matttrax wrote:Sorry, thought it was clear from the code.
Say you are in Company A. Item is a record from the Item table.
In OnInsert or OnModify you would need to do:
Item.CHANGECOMPANY(Company
;
IF NOT Item.GET("No.") THEN
Item.INSERT;
The CHANGECOMPANY function literally points that record variable to another company, so even though you may be operating in Company A, that record variable will only see records in the company you've changed to.
Is that more clear?
..but remember to watch any field that validates, as the validation logic will not be impacted by the change company logic (in some cases you can get away with it (like if the validate is just a lookup to a table that contains the same data in all companies). i'd search the forum for CHANGECOMPANY and learn from that.kind of fell into this...0 -
This process has been described my blog... :oops:
http://dynamicsuser.net/blogs/alexchow/ ... n-5-0.aspxConfessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
Do you make it right, it works too!0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions

