No, but you can use NAS (Navision application server) to run it on some event (for example the event can be something in message queue, TCP socket, etc. ) Search this forum for NAS and you will see that there are many posts about this "how to run C/AL code without using client" etc....
If you own the granule with the job scheduler, I think it can be used but that may only be reports. I could be a :^o
There are also third party tools available such as expandit.com's launch utility which we use. It works well and is very simple. I cannot remember what it costs but they provide a demo if you wish to test it. You would need to setup one .ini for each company and either daisy chain or run them one at a time on the windows event scheduler.
I don't think NAS is a good idea if they have 10 companies. You would have to have 10 instances of NAS running. Although I do remember someone saying something about using multiple services with one instance of NAS and controlling those services using some kind of network command.
I don't think NAS is a good idea if they have 10 companies. You would have to have 10 instances of NAS running. Although I do remember someone saying something about using multiple services with one instance of NAS and controlling those services using some kind of network command.
You may try to use CHANGECOMPANY to access different companies with only one NAS.
I did not test this before, but i heard that this should work.
I do think about using NAS, but the problem is, I need to run a codeUnit for 10 companies (may be up to 15 companies).
For ChangeCompany function, there is a very big limitation on it. When we call
Record.ChangeCompany('A');
It would change company scrope for the record only, if I call Field validation, then it will be execute in the current company, which is wrong.
Maybe let me provide the whole story in my case:
I have 20 companies in Navision.
I have a global table, which store external Item master + item dimension.
Now I need to transfer these data into 10 companies as item.
At the begining I thought to write a codeUnit, run it in any company, and using ChangeCompany to copy external item into 10 companies. However it has limitation on it. Finally I think I need to run the codeUnit individually for 10 companies - That is, open 10 NA clients, each for 1 compaines and run the same codeUnit individually.
I would like to simplify this process (open 10 NA client, select which company, and run the codeUnit), so I want to find a way to do.
Currently I have an idea (maybe not too good), create a form, which will call the codeUnit. Then I save the "SHORTCUT" file on desktop.
This way if I double click the "ShortCut" file, system will run NA Client, go to the correct DB + company, open the form-> run the codeUnit.
About the NAS for more companies - you can try to run the NAS for first one - run the actions you need - change company parameter for the NAS in registry to next company - restart the NAS (exit the CU or through 'net' command). Next run of the NAS will be running for another company...
We are lucky that everything you can do in Navision just by the keyboard. Autohotkey is a macro toool. Also can start programs and whatever.
What you have to do is assign a username to this task and write to Codeunit 1 at the end of Loginstart function that IF USERID='WHATEVER' Codeunit.RUN...
So you can write a macro in Autohotkey to run fin.exe and the Alt+something key combos to open all companies and log in as this user. And the the CU runs automagically.
Do It Yourself is they key. Standard code might work - your code surely works.
So some doophus changes the shortcut key, or adds the same one to another menu group and all of a sudden you're screwed. Using a key macro tool might look cool but it is NOT valid a solution. It's a band-aid not a cure.
You could still use CHAMGECOMPANY, but you'd have to cutomize the validation code in your codeunit and make all rec variables change company as well, I've made that work a few times.
I think your best bet is either do the changecompany, or use the NET command, there should be a sample in the download section, it's written by Kriki.
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
There are also third party tools available such as expandit.com's launch utility which we use. It works well and is very simple. I cannot remember what it costs but they provide a demo if you wish to test it. You would need to setup one .ini for each company and either daisy chain or run them one at a time on the windows event scheduler.
http://www.archerpoint.com
http://www.expandit.com/templates/expan ... log_id=633
http://www.BiloBeauty.com
http://www.autismspeaks.org
RIS Plus, LLC
IMHO NAS would do the best job.
You may try to use CHANGECOMPANY to access different companies with only one NAS.
I did not test this before, but i heard that this should work.
Regards
IHateLinux
Thanks for all your reply and suggestion.
I do think about using NAS, but the problem is, I need to run a codeUnit for 10 companies (may be up to 15 companies).
For ChangeCompany function, there is a very big limitation on it. When we call
It would change company scrope for the record only, if I call Field validation, then it will be execute in the current company, which is wrong.
Maybe let me provide the whole story in my case:
I have 20 companies in Navision.
I have a global table, which store external Item master + item dimension.
Now I need to transfer these data into 10 companies as item.
At the begining I thought to write a codeUnit, run it in any company, and using ChangeCompany to copy external item into 10 companies. However it has limitation on it. Finally I think I need to run the codeUnit individually for 10 companies - That is, open 10 NA clients, each for 1 compaines and run the same codeUnit individually.
I would like to simplify this process (open 10 NA client, select which company, and run the codeUnit), so I want to find a way to do.
Currently I have an idea (maybe not too good), create a form, which will call the codeUnit. Then I save the "SHORTCUT" file on desktop.
This way if I double click the "ShortCut" file, system will run NA Client, go to the correct DB + company, open the form-> run the codeUnit.
Any comment on it? Any better idea?
Thanks.
Best Regards
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Job Scheduler works also with CodeUnits. It ca be used also in this situation. But you need the granule ...
We are lucky that everything you can do in Navision just by the keyboard. Autohotkey is a macro toool. Also can start programs and whatever.
What you have to do is assign a username to this task and write to Codeunit 1 at the end of Loginstart function that IF USERID='WHATEVER' Codeunit.RUN...
So you can write a macro in Autohotkey to run fin.exe and the Alt+something key combos to open all companies and log in as this user. And the the CU runs automagically.
Do It Yourself is they key. Standard code might work - your code surely works.
You could still use CHAMGECOMPANY, but you'd have to cutomize the validation code in your codeunit and make all rec variables change company as well, I've made that work a few times.
I think your best bet is either do the changecompany, or use the NET command, there should be a sample in the download section, it's written by Kriki.
RIS Plus, LLC