Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

CHANGECOMPANY not working in Dynamics NAV 2013 R2

Posted on by Microsoft Employee

CHANGECOMPANY function:

2 Companies, A and B.

I create a record X in Company A.

The record X was created in company A and B.

---

I open company B, and begin to use it.

I change the some record X.

There is an error in MODIFY trigger, which not allow to modify the record in company A, saying the record is in use by another user.

---

SO, IT SEAMS THE RECORDS CAN ONLY BE CHANGED FROM THE COMPANY WHERE THE INITIAL CREATION WAS DONE.

This is a critical issue for Intercompany Projets.

---

Is anyone have teh same experience and found a solution for this ?

Thank you. in advance.

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: CHANGECOMPANY not working in Dynamics NAV 2013 R2

    Yes this is an issue I just had today. Changing to ,FALSE at the end fixes the issue. What is curious for me is this is not a problem in 2009 but is in 2015. So something about TRANSFERFIELDS has changed between the versions, but the change is not mentioned or documented between the 2009 and 2015 help files.

    I would be interested, if anyone knows, what the actualy change / reason is in the background. Is the TIMESTAMP treated differently somehow in the two versions?

  • Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: CHANGECOMPANY not working in Dynamics NAV 2013 R2

    Glad, you resolved it.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: CHANGECOMPANY not working in Dynamics NAV 2013 R2

    I GOT THE ANSWER !

    TRANSFERFIELDS MUST BE LIKE THIS, IN THE EXAMPLE:

    Customer.TRANSFERFIELDS(CustomerPar,FALSE);

    ... because of Timestamp. See in Help.

    Tks all that care my problem.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: CHANGECOMPANY not working in Dynamics NAV 2013 R2

    Partner. KBC Portugal. Explanation more with  oe detail: Suppose we have a function in trigger MODIFY inside tabel 18 Customer (KWICMngt.ICCopyCustomer(Rec,2,FALSE);)in company A; this function call a function in company A, inside a Codeunit; in that Codeunit we just make a CHANGECOMPANY for another company B :                                                      

    In fact, I think really the problem is the TRANSFERFIELDS that is working in a way that we don't understand.

    If we put a single or few fields only it's working.

    Take a look this example:

    Not working:

         Customer.CHANGECOMPANY(CompanyB);

         IF Customer.GET(CustomerPar."No.") THEN BEGIN

                 Customer.TRANSFERFIELDS(CustomerPar);

                 IF NOT Customer.MODIFY THEN

                   ERROR ...

          END;    

    Working:

         Customer.CHANGECOMPANY(CompanyB);

         IF Customer.GET(CustomerPar."No.") THEN BEGIN

                Customer.Address:=CustomerPar.Adress;

                Customer."Post Code":=CustomerPar."Post Code";

                Customer.City:=CustomerPar.City;

                 IF NOT Customer.MODIFY THEN

                    ERROR ...

          END;    

    Tks.

  • Rashed Profile Picture
    Rashed 3,765 on at
    RE: CHANGECOMPANY not working in Dynamics NAV 2013 R2

    You probably have some bad modification/ recursive triggers.  check your code. 

  • Verified answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: CHANGECOMPANY not working in Dynamics NAV 2013 R2

    'The real fact is that MODIFY from another company is not working' what do you mean its not working ?

    Are you a partner or customer?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: CHANGECOMPANY not working in Dynamics NAV 2013 R2

    I Suresh. I do not use TRUE, just a simple MODIFY. And I call a Codeunit function from Customer Modify trigger. INSERT and DELETE is fine, but MODIFY no. It's really an issue that is not ok. The real fact is that MODIFY from another company is not working. Maybe we have to put this to Microsoft. Do you know where we have a channel to do that more quickly ? Tks.

  • Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: CHANGECOMPANY not working in Dynamics NAV 2013 R2

    Are you using MODIFY(TRUE) ? because when you use MODIFY(TRUE) or INSERT(TRUE) it will execute the in the current company and not in the change company. So do not use it, just use MODIFY and copy the code from the modify trigger and execute it separately in your process.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans