we are implementing navision for an education centre. the navision runs on MS SQL, and each student will have a dedicated company in the MS SQL database. the no. of students enrolled per semester is 200. that means, 200 companies has to be created in navision. is there any where to automate the creation of companies in navision in MS SQL? if not, the administrator, has to create the companies one by one and it would take a long… time.
Hi Jordan, You can use this simple example to Create and Initialize a new Company: Comp record Company InitCmp codeunit Company-Initialize ACompName text 30 Comp.INIT; Comp.Name:=ACompName; Comp.INSERT; InitCmp.ChangeCMP(ACompName); InitCmp.RUN; after add to the codeunit 2 the following function: Global Function ChangeCMP(Cmp : Text[30]) GLSetup.CHANGECOMPANY(Cmp); CompanyNotesSetup.CHANGECOMPANY(Cmp); SalesSetup.CHANGECOMPANY(Cmp); PurchSetup.CHANGECOMPANY(Cmp); InvtSetup.CHANGECOMPANY(Cmp); ResSetup.CHANGECOMPANY(Cmp); JobSetup.CHANGECOMPANY(Cmp); HumanResSetup.CHANGECOMPANY(Cmp); RMSetup.CHANGECOMPANY(Cmp); ServiceMgtSetup.CHANGECOMPANY(Cmp); NonstockItemSetup.CHANGECOMPANY(Cmp); FASetup.CHANGECOMPANY(Cmp); SourceCode.CHANGECOMPANY(Cmp); SourceCodeSetup.CHANGECOMPANY(Cmp); Stdtxt.CHANGECOMPANY(Cmp); ReportSelection.CHANGECOMPANY(Cmp); WhseSetup.CHANGECOMPANY(Cmp); CPSetup.CHANGECOMPANY(Cmp); ObjTransl.CHANGECOMPANY(Cmp);
Another way … backup default company… rename, restore, rename, restore…
See you in 12472 years then!
I see this works. However, my users need to be granted access to the company newly added, so that they can initialize them. Windows Authentication… Any suggestions?