AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 17.01.2013, 05:29   #1  
Blog bot is offline
Blog bot
Участник
 
25,644 / 848 (80) +++++++
Регистрация: 28.10.2006
After long time I have found some free time and subject worth to write something. During my work on my DynamicsNAVProtocolHandler (with some help from Daniel Steiner from redIT) I have found one thing I didn’t know about in NAV 2013.


Do you need to know server, instance or some setting of the NAV Server you are connected to?
If you need something regarding the NST you are just using in the NAV Win client, you can be inspired by code from codeunit 9500. There is one DotNet class you can use for this:


Microsoft.Dynamics.Nav.Types.ConfigSettings
If you use this class, you gain access to the server settings. And if you are lucky, you can even change the settings (property CanSetSettings will tell you that). This class have method to read any setting by entering the name of the setting, or there are specific properties for the most used.


Bug in CU 9500
You can hit this bug when you are running NST on non-default port and you want to open session list. Because the session list is opened by CU 9500 by generating hyperlink and launching it, you can correct this bug easilly. The code is just not taking into account the server port. We are lucky, that this part is in C/AL and not hardcoded into the client. Just extend the code like this:

1:
2: ServerComputerName := Config.GetStringSetting('Server');
3: ServerInstance := Config.GetStringSetting('ServerInstance');
4: ServerPort := FORMAT(Config.ClientServicesPort); //added line
5:
6: //Add parameter %4 into the URL
7: UrlString := STRSUBSTNO('DynamicsNAV://%1:%4/%2/%3/debug',ServerComputerName,ServerInstance,COMPANYNAME,ServerPort);
8: HYPERLINK(UrlString);




You can see both ways of reading the settings:

  • through the GetStringSetting
  • through property (CientServicesPort)

Conclusion

Thanks for the DotNet interop and the standard NAV assemblies which allows NAV developer to have access to NAV inside values! I hope that I will find more connections between .NET and C/AL like access to the actions etc. from within C/AL code.





Have a nice days with playing with C/AL!



Источник: http://blogs.msmvps.com/kine/2013/01...av-2013-tip-2/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 


Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 18:33.