web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

How to update data of a table from another company ?

(0) ShareShare
ReportReport
Posted on by

Hi,

I have a requirement to build a report to update data of a table for other companies ( same Nav database)

Input: table id

Run the report in the company A for table XXX;

For each record: check if the data in table XXX in company has same value -> if yes then do nothing.

If no and the record is not exist -> insert the record to table XXX in company B

If no and the record exist -> check which fields are modified -> only update these changed fields.

For this requirement: I need to check what is the primary key fields of a table; so I will check if we need to update or insert. and also I need to compare all the fields of a table between two company.

this solution is also need to be generic ( table need to be copied will be key in by users in input screen) we don't know fixed table in advance.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Mohana Yadav Profile Picture
    61,005 Super User 2025 Season 2 on at

    check CHANGECOMPANY, RecordRef and FieldRef and KeyRef

  • Suggested answer
    Amol Salvi Profile Picture
    18,698 on at

    Hi,

    You need to use changecompany function to update the records from one company to another

    msdn.microsoft.com/.../dd338929(v=nav.90).aspx

  • Verified answer
    Tharanga Chandrasekara Profile Picture
    23,118 on at

    As Mohana said you need to check on CHANGECOMPANY - which will allow you to change the company during runtime. Make sure to change the company back to original company once the calculation is over, otherwise rest of the logic will apply to the changed company.

    https://msdn.microsoft.com/en-us/library/dd338929(v=nav.90).aspx

    About the fields, you need to check on RecordRef and FieldRef and KeyRef functions in Dynamics NAV.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
HoangNam Profile Picture

HoangNam 7

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans