Change Company

ngebhardngebhard Member Posts: 127
Hi everybody!

I have a question about two companies on one database. I want to insert a table entry in one company out of the other company. Therefore I can use "table.changecompany(XYZ)" which works quite well. I only have a problem validating a field. Navision validates the field in the actual company. In my case I get the message "Customer No. doesn't exist", because the customer belongs to the other company and can't be validated for this reason. Did I miss something or does this just not work to validate in the other company?

We have company programmings as well which aren't correct because Navision checks the actual companyname and not the one of "table.companyname(XYZ)". Any hints about that?

I have already some ideas for a workaround but I wanted to make sure, that I didn't miss a simple thing.

Thanks!
Nicole
ProTAKT Projekte & Business Software AG
Microsoft Dynamics NAV Partner
Bad Nauheim, Germany
http://www.protakt.de
http://twitter.com/protakt

Comments

  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Hi,

    You are right about the validation thing, it is always in the current company.

    The are several solutions to this problem.

    You can program code that does the validation with all the changecompany etc. This is quite complex and time consuming. Also this results in the maintanance problems mostly.

    Easiest solution is to have a intercompany table in which to enter a record for a different company. You can have a NAS or a navision client loging in to the right company and finish the transacion.

    I hope I've explained it correctly, otherwise, just ask.
  • ngebhardngebhard Member Posts: 127
    Hi Mark,

    thanks for your reply. I already thought about such a transfer table from which I can insert the data into the right tables after changing the company. Since there are only a few lines a month to be transferred I won't implement a NAS. I can trigger the functionally within the opening of the form. This shouldn't be any problem.

    I just wanted to make sure that there isn't a simple coding similar to "changecompany" which I just don't know yet.

    :D

    Thanks.
    Nicole
    ProTAKT Projekte & Business Software AG
    Microsoft Dynamics NAV Partner
    Bad Nauheim, Germany
    http://www.protakt.de
    http://twitter.com/protakt
  • Timo_LässerTimo_Lässer Member Posts: 481
    We had the same problem in the past at one of our customers.
    He wanted to "synchronize" items from one "master company" to several companies within the same database.

    We decided to copy the data without field validate to the other companies.
    Further more, we created for each company a log entry with the item no. and what action should be done (e. g.: Table 27, Field 18, WHERE (Field1=70000), Action::Validate).
    For each company a job scheduler runs every 10 Minutes a report which proceed this log entries.

    This works fine.
    Timo Lässer
    Microsoft Dynamics NAV Developer since 1997
    MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
  • DenSterDenSter Member Posts: 8,307
    I've developed 'global items/vendors/customers/etc.' a number of times, nd once you get the hang of it, it's not so bad. What I ended up doing is *kind of* copying the validation code in separate functions, but only to do the important part of the validation. You'll have to take care of the CHANGECOMPANY settings for each and every record type variable, to ensure that data gets updated in the right company.
  • davmac1davmac1 Member Posts: 1,283
    I have to create global contacts for several companies.
    One idea I have is to create a common table to keep the individual companies contacts in sync.
    I am a little surprised that Navision has not addressed this area. One of the biggest problems companies have is having one central contact database.
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    davmac1 wrote:
    I have to create global contacts for several companies.
    One idea I have is to create a common table to keep the individual companies contacts in sync.
    I am a little surprised that Navision has not addressed this area. One of the biggest problems companies have is having one central contact database.

    We usualy share the contact[5050] table and add the companyname to the key of the 5054 table. This does most of the trick.

    Also remember to change the Synchronisation codeunits for customers/vendors etc and the Delete trigger of the 5050 table.
Sign In or Register to comment.