Skip to main content

Notifications

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

  • Verified answer
    Tharanga Chandrasekara Profile Picture
    23,116 on at
    RE: How to update data of a table from another company ?

    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.

  • Suggested answer
    Amol Salvi Profile Picture
    18,698 on at
    RE: How to update data of a table from another company ?

    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
    Mohana Yadav Profile Picture
    60,232 Super User 2025 Season 1 on at
    RE: How to update data of a table from another company ?

    check CHANGECOMPANY, RecordRef and FieldRef and KeyRef

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Microsoft Dynamics NAV (Archived)

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2

#1
mmv Profile Picture

mmv 2

#1
Amol Salvi Profile Picture

Amol Salvi 2

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans