how to record in Change Log Entry if using Transferfield ?

julkifli33
Member Posts: 1,092
Hi all.
i am using Cloud BC
i have developed on sync button from company A to company B
both companies i have turned on the Change Log Activities.
but in company B it wont recorded in Change Log Entries.
Scenario :
i created new item in company A
so i want to push this new item from Company A to Company B
in company A it is recorded in change log entries, but not in company B
any idea how do i record this in company B ?
My Code
i am using Cloud BC
i have developed on sync button from company A to company B
both companies i have turned on the Change Log Activities.
but in company B it wont recorded in Change Log Entries.
Scenario :
i created new item in company A
so i want to push this new item from Company A to Company B
in company A it is recorded in change log entries, but not in company B
any idea how do i record this in company B ?
My Code
SyncCompany.reset; SyncCompany.Setfilter(SyncCompany."Company Name", '<>%1', CompanyName); if SyncCompany.findset then begin Repeat IF FromItem.Get(ParItemNo) then begin MediaGuid := FromItem.Picture.MEDIAID; ToItem.ChangeCompany(SyncCompany."Company Name"); ToItem.Reset; if ToItem.get(ParItemNo) then begin ToItem.TRANSFERFIELDS(FromItem); ToItem.Selected := FALSE; ToItem.MODIFY(true); Commit(); end else begin ToItem.TRANSFERFIELDS(FromItem); ToItem.Selected := FALSE; ToItem.INSERT(TRUE); end; FromItem.Modify(true); end; until SyncCompany.next = 0;
0
Answers
-
I think that the log entries of B are recorded in company A. I recently reported that, it is not really clear if this is a bug or a feature. You can probably work around this by running the write process in the company of the new records, so log entries are recorded in that company. The read action will then be done in "the other company". This is any way the best construction, because events and code triggers will also be executed in that company.IF User.Loves('Edo') THEN ok() ELSE currReport.genSkip;0
-
I checked there are only 2 rows in change log entries company B
which is Last Date Modified and Last DateTime Modified.
another method i used (for another table) is delete all, and then re-insert back all..
this method will show all records in change log entries company B.
for item table i cant use this method0 -
Another question ... do you get the log entries when you make the changes to the table manualy?IF User.Loves('Edo') THEN ok() ELSE currReport.genSkip;0
-
if manual, yes.. it will be recorded in change log entries.0
-
I think this is by design , Triggers and functions will still run in the context of the current company , not in the company that you specified in the CHANGECOMPANY function. It will only transfer data . You may need to consider using API to sync between companies if need to trigger the change log.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