Options

Create a 'Master Company' Nav2013 R2

WakersWakers Member Posts: 3
edited 2014-12-17 in NAV Three Tier
Hi,


We have more than 100 companies on navision, we will harmonize the tables to be consistent.
What I'd like to do:
If for example I want to add a vendor in a 'master company ', this vendor is automatically add in all my other company.
Have you ever done this? Can you give me advice?

Thanks for help ;)

Sylvain

Comments

  • Options
    postsauravpostsaurav Member Posts: 708
    Hi,

    I guess that seems to be possible with a little bit of customization -

    1. On insert, modify triggers of the vendor table you can write a code which will follow like -
    a) change the company via code. (ChangeCompany)
    b) copy the record and insert in the changed company.

    Thanks & Regards,
    Saurav Dhyani

    Do you Know this About NAV?


    Connect - Twitter | Facebook | Google + | YouTube

    Follow - Blog | Facebook Page | Google + Page
  • Options
    WakersWakers Member Posts: 3
    Thanks for your help,

    I have an other question, If i put changecompany code on the trigger, i have to LOOKED the table in the other company or not?
    Because if an other user is on the vendor table maybe i will me problematic ?
    Can we use VALIDATE function with ChangeCompany?

    Thanks for sharing your experience :) (and sorry for my english)
  • Options
    MarijnMarijn Member Posts: 69
    To my knowledge, the CHANGECOMPANY statement is only useful in the simplest of cases, because it will not execute any related code in the foreign company. If you want all business logic to be executed, use NAV Web Services to call a function in Company B from Company A. That will always work. For example, you can even post documents in another company using wevservices. CHANGECOMPANY will not allow you to do that.
  • Options
    MarijnMarijn Member Posts: 69
    To my knowledge, the CHANGECOMPANY statement is only useful in the simplest of cases, because it will not execute any related code in the foreign company. If you want all business logic to be executed, use NAV Web Services to call a function in Company B from Company A. That will always work. For example, you can even post documents in another company using wevservices. CHANGECOMPANY will not allow you to do that.
  • Options
    JutJut Member Posts: 72
    I could imagine that some ISV might have a standard solution for this - actually my former employer had one solution but it was specific to their industry and not very good :roll:

    You may want to take a look at the STARTSESSION-command that was introduced in NAV 2013. It allows you to start a session with a specified codeunit (e.g. your codeunit that creates your vendor) and a chosen company name. Contrary to changecompany this really changes the entire context to that company.

    If you wrap that STARTSESSION-command in a loop on the company table it will be called for all companies. The tricky part is probably more logical than technical since you will have to take care of all related tables to avoid table relation violation.

    I hope this helps!

    Regards,
    Julian
Sign In or Register to comment.