Microsoft Dynamics NAV 2013 Tip 2

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!

Posted by kine | with no comments

Microsoft Dynamics NAV 2013 Tip 1

NAV 2013 is bringing many changes from technological point of view, but even from end-user view. I will try to give you few interesting tips about features, which could be very useful, but could be easily overlooked.

First tip, which is very small and hardly to find, because it is nothing “new”, with some new Action button, but rather re-worked standard functionality.

In NAV 2009 RTC nearly all users were missing possibility to Copy&Paste records. In classic client, users were used to copy records between same tables. It was not possible in RTC. Now, in NAV 2013, you are able again to do that. But on totally another level than in classic client.

NAV Copy&Paste Extended

Try this:image

  • Open MS Excel
  • Create this small table:
Item 1000
Resource LINDA
  • Create new Sales Order in NAV Win client
  • Mark the table in Excel, Copy it
  • Go into Sales order lines, Paste the rows (Ctrl+Shift+V or use the context menu)

Result? New two lines for item 1000 and resource LINDA.

Are you excited? I was too… Just imagine – you do not need Excel import, you only need page with correct columns in correct order and Excel with data. You are done. You can fill the table by just copy&paste.

Of course, data are pasted column by column, row by row. It means, column must be in same order, including non-editable fields, validation is triggered in same order as columns. But you can easily change the field order and visibility through the customization options in Win client or change the column order in excel.

Of course, you can select all rows, copy them into excel, correct the data, paste them back.

I think that this, is one from the invisible jumps which are included in NAV 2013, but are not the correct features for the “big applaus”. But I think that many consultants and end-users will be happy.

Bravo NAV team! :applaus:Thumbs up

Posted by kine | 1 comment(s)
Filed under: ,

DynamicsNAV protocol handler

Now, when NAV 2013 beta was released, many partners could struggle from the problem of side-by-side installation of the NAV clients. Problem is, that the development environment is using the URI (hyperlinks) to open the objects in RTC. Because the protocol is handled by default only the latest installed version, you can have problem if you need to use it with more versions. And because that, I have created this handler for you.

Download v 1.0.2.0

NVR_DynamicsNAVProtocolHandler

After you copy the files somewhere and run the exe, you can activate the handler. Since that, instead the RTC my app will be started for each opened URI. The app will try to find correct version of RTC to run. This could be a problematic, but if you open the URI directly from active classic client, it should work. If you run the hyperlink e.g. from “Run” dialog of windows, the default RTC will be used (there is no way yet to check version of the target NST I know). If you have some tip how to check that…

 P.S.: Using this handler, the Windows 7 "Jump Lists" will not work for NAV. It means, you will not have the new feature of Windows 7, when you can directly from the application icon start some functionality without opening the client first. This is working only when the handler is deactivated and you run the RTC once after that.

P.S.: 18.5.2012 11:09 - download updated to v 1.0.2.0

P.S.: 19.5.2012 17:01 - project moved to http://navprotocolhandler.codeplex.com/, new versions released (with some bugs fixed)

Have a fun with NAV!

Posted by kine | with no comments

Microsoft Dynamics NAV 2013 beta–installation and configuration tips

If you are installing Microsoft Dynamics NAV 2013 beta, you can struggle from some problems. There are some tips for you:

Ports

If you are installing the NAV server on computer, where are already some NAV services, you need to use different ports for the NAV 2013 services. NAV 2013 beta is not supporting Port Sharing. You need to think on it when configuring the installation.

Function not supported

When you successfully installed the NAV 2013 client with development environment on PC, where the NAV 2009 is already installed, you can have problems when you try to run something from the devenv. Instead starting the RTC client, you will see error that “Function not supported”. Weird on first sight could be, that you see the error e.g. in your local language, even you have installed the W1 version of NAV 2013. Problem is, that the devenv is using the protocol DYNAMICSNAV to run the RTC. On my PC the NAV 2013 installation have not changed the path for this protocol. You need to check the registry path “HKEY_CLASSES_ROOT\DYNAMICSNAV\Shell\Open\Command” and look if there is NAV 2013 path or not.

You can deduct from this, that coexistence of NAV 2009 and NAV 2013 will be problem. Running page from NAV 2009 classic client will run NAV 2013 RTC after this, or NAV 2013 devenv will start NAV 2009 RTC if not changed. You can decide what will suit you most. But one info: to run the table from NAV 2013 devenv, NAV need to run the RTC, In general, NAV 2013 devenv is more linked to the RTC. I expect that most of you will want to run NAV 2013 RTC through the DYNAMICSNAV protocol. It is question of time till someone will develop some tool which will correctly decide what to run… ;-)

NavUserPassword authentication

Because the Domain groups are not working in the NAV 2013 beta, it could be a problem to add all the users into NAV. You can decide to use the new authentication model “NavUserPassword”, where you create login and password directly in NAV without connection to Active Directory, which you can then share with the users to provide the “demo” access. BUT! It is not so simple. You need to go through few steps:

  1. Change the NST settings – you need to change the ClientServicesCredentialType to NavUserPassword instead the default Windows value.
  2. Create certificate – to be able to login by user name and password, NAV need to crypt the transport. For this, he need certificate. You can create self-signed certificate by using commands mentioned in the .config file:

    makecert -n "CN=YourServiceNameOrURL" -r -sky exchange -sv YourFileName.pvk YourFileName.cer
    pvk2pfx -pvk YourFileName.pvk -spc YourFileName.cer -pfx YourFileName.pfx
    certutil -importpfx YourFileName.pfx


    Where to take the makecert and pvk2pfx tools? You can take them e.g. from Windows SDK.

  3. Enter the certificate thumbprint into the config – first, you need to look at the Thumbprint on the generated certificat. Open it, find the field thumbprint, remove the spaces and the value enter into ClientServicesCertificateThumbprint key in the config of NST.
  4. Change the RTC authentication type – in the file c:\Users\<loginname>\AppData\Roaming\Microsoft\Microsoft Dynamics NAV\70\ClientUserSettings.config change the settings named ClientServicesCredentialType to same value as in step 1.
  5. Make the client to trust the certificate – import the certificate to the client PC, to trust it. Or you can disable the check by changing value ClientServicesCertificateValidationEnabled in the config.
  6. After all this, you can still have problem to run the NST service. In event log you can see error with error like “no access to the keys” or something similar. It means that the NST service have not enough permissions to read the certificate keys. Try to run it as admin. It should work. Quick fix is to add permissions for the service account on folder c:\ProgramData\Microsoft\Crypto\RSA\MachineKeys\.

Installation of NAV 2009 when compiling objects

After you install NAV 2013, you can have problems with compiling objects with older version of NAV like NAV 2009. When you start compile some object which use automation variable, it will start NAV 2009 installer and will try to repair the installation. It is because registry info about NAV help libraries like NTimer.dll, NSAppHandler.dll etc. were changed. You can repair it by unregistering and reregistering the dlls. I have created batch for this. You can use it (it is designed for 64bit systems). Just create file with this text, save it as .cmd file and run it as admin:

------------------

regsvr32 "c:\Program Files (x86)\Common Files\Microsoft Dynamics NAV\OLHandler\OLHandler.dll" /u /s
regsvr32 "c:\Program Files (x86)\Common Files\Microsoft Dynamics NAV\Application Handler\NSAppHandler.dll" /u /s
regsvr32 "c:\Program Files (x86)\Common Files\Microsoft Dynamics NAV\Commerce Gateway Client\CGReqClient.dll" /u /s
regsvr32 "c:\Program Files (x86)\Common Files\Microsoft Dynamics NAV\Commerce Gateway Client\CGTimer.dll" /u /s
regsvr32 "c:\Program Files (x86)\Common Files\Microsoft Dynamics NAV\Communication Component\NPipeBusAdapter.dll" /u /s
regsvr32 "c:\Program Files (x86)\Common Files\Microsoft Dynamics NAV\Communication Component\NSComCom2.dll" /u /s
regsvr32 "c:\Program Files (x86)\Common Files\Microsoft Dynamics NAV\Communication Component\SocketBusAdapter.dll" /u /s
regsvr32 "c:\Program Files (x86)\Common Files\Microsoft Dynamics NAV\Communication Component\MSMQBusAdapter.dll" /u /s
regsvr32 "c:\Program Files (x86)\Common Files\Microsoft Dynamics NAV\Timer\NTimer.dll" /u /s 
regsvr32 "c:\Program Files (x86)\Common Files\Microsoft Dynamics NAV\NatHash\NATHash.dll" /u /s
regsvr32 "c:\Windows\SysWOW64\comdlg32.ocx" /u /s

regsvr32 "c:\Program Files (x86)\Common Files\Microsoft Dynamics NAV\OLHandler\OLHandler.dll" /s
regsvr32 "c:\Program Files (x86)\Common Files\Microsoft Dynamics NAV\Application Handler\NSAppHandler.dll" /s
regsvr32 "c:\Program Files (x86)\Common Files\Microsoft Dynamics NAV\Commerce Gateway Client\CGReqClient.dll" /s
regsvr32 "c:\Program Files (x86)\Common Files\Microsoft Dynamics NAV\Commerce Gateway Client\CGTimer.dll" /s
regsvr32 "c:\Program Files (x86)\Common Files\Microsoft Dynamics NAV\Communication Component\NPipeBusAdapter.dll" /s
regsvr32 "c:\Program Files (x86)\Common Files\Microsoft Dynamics NAV\Communication Component\NSComCom2.dll" /s
regsvr32 "c:\Program Files (x86)\Common Files\Microsoft Dynamics NAV\Communication Component\SocketBusAdapter.dll" /s
regsvr32 "c:\Program Files (x86)\Common Files\Microsoft Dynamics NAV\Communication Component\MSMQBusAdapter.dll" /s
regsvr32 "c:\Program Files (x86)\Common Files\Microsoft Dynamics NAV\Timer\NTimer.dll" /s 
regsvr32 "c:\Program Files (x86)\Common Files\Microsoft Dynamics NAV\NatHash\NATHash.dll" /s
regsvr32 "c:\Windows\SysWOW64\comdlg32.ocx" /S
------------------

This will do it for you. I am not sure if it is just my local problem or it is because NAV 2013 was installed side-by-side with NAV 2009. If you hit this problem, it should help you…

Posted by kine | with no comments
Filed under: ,

NAV 2013 beta–What’s new

It is time to look at new features in NAV 2013 C/Side. This will be quick overlook of new commands and functionality in the developers environment, which is replacement of the classic client and is intended only for developing now.

New commands

[Ok :=] xRec.SETAUTOCALCFIELDS([Field1] ,...)[Ok :=] xRec.SETAUTOCALCFIELDS([Field1] ,...)

Using this command you tell NAV to automatically calc the FlowFields after new record is read into the variable. You do not need to call CALCFIELDS in the repeat-until loop now and the fields will be calculated in one step with the reading the data.

[SecurityFiltering :=] xRec.SECURITYFILTERING([SecurityFiltering])

The security filter model was changed in NAV 2013 and I hope that it will be much more usable now. Through this command you can set different modes:

  • Filtered – The security filters are applied to the record. Records outside the filter are unvisible for the user and for the code it looks like there are no other records.
  • Validated – Similar to Filtered but if you try access record outside the filter, you will get error. This mode is similar to the pre NAV 2013 behavior and have impact to performance.
  • Ignored – The security filters are ignored for this record variable.
  • Disallowed – If there is some security filter set on the table, it will lead to the error. It means, you can use it in process, where you want to be sure, that it is running by user, which have no security filters set on the table.

For more info I recommend to read the C/Side help topic “Security Filter Modes”.

Keys

If you run the Symbol menu, you can find out that there is new group of command for each record variable, just under the “Functions” group. In this Keys group you can select existing keys and insert it into the code. No more manual entry of keys in NAV 2013!

Type := GETDOTNETTYPE(Expression)

This command will help you when using DotNet interop. It will return you the type object for the selected assembly. In NAV 2009 you needed to use workarounds to get the type.

Ok := CANLOADTYPE(DotNet)

Before you use some assembly, you can test if you can use it. Could help you when you are not sure, if the assembly is installed.

String := CAPTIONCLASSTRANSLATE(CaptionClassText)

Function will translate the caption class. It is using new function in CU1 with ID 15.

 

[IsActive :=] CODECOVERAGELOG([NewIsActive] [, MultiSession])

This old command have new parameter – MultiSession. It looks like now you can use codecoverage for all sessions…

CODECOVERAGEINCLUDE(ObjectRecord)

No more info on this, it looks like you can enable CodeCoverage only for selected object.

CODECOVERAGEREFRESH

It looks like it reread the codecoverage data.

CODECOVERAGELOAD

No info on this. May be similar to previous one…

String := GETLASTERRORCODE

New command to read the error code.

String := GETLASTERRORCALLSTACK

If there is error, you can read the call stack to be able to show more info to user or log more info somewhere.

New debugger commands

There is whole new set of commands to work with debugger. Because the new debugger is based as Page in NAV, all functions of the debugger are exposed as commands and tables within NAV. It means, if you want, you can create your own debugger in NAV!

New session commands

 

Classic NAS was replaced with functionality, which allows C/AL to create new sessions which are doing what you need in background. There are new three commands for this:

[{Ok} :=] STARTSESSION(SessionId, CodeunitId [, Company] [, Record])

Start new session, which will run the selected codeunit, in selected company with selected record.

ExecutionMode := CURRENTEXECUTIONMODE

Return the execution mode of the current session. The execution modes are EXECUTIONMODE::Standard or EXECUTIONMODE::Debug.

[{Ok} :=] STOPSESSION(SessionId [, Comment])

You can decide to stop previously started background session.

USID := USERSECURITYID

Will tell you the User SID. Usage? Do not know yet…

SETUSERPASSWORD(USID, Password)

If you are using NavUserPassword authentication, you can change the password for selected user through code.

CHANGEUSERPASSWORD(OldPassword, NewPassword)

If you are using NavUserPassword authentication, you can change the password of current user through this function.

ID := SESSIONID

Will return the current session ID.

ID := SERVICEINSTANCEID

Will tell you ID of your NST.

Test page functionality

There is whole new area of functionality about testing the pages. You can simulate the user actions through the new commands. Than you can run automatized tests of the UI! I recommend to read more in documentation, look at some blog articles, watch the recorded sessions about this…

Query functionality

Again, whole new area of functionality. You can use the Query object to read data through complex select statements and loop through the result in code or save it as XML or CSV file.

DotNet interop changes

You can now consume events of the DotNet assemblies (WithEvents property).

Addin changes

When you are creating addins, you can again create events which you can consume in NAV, or you can add methods, which you can call from NAV. And there is more than that. You can set the Addin behaviour lik automatic resize etc.

Conclusion

There is a LOT of new things in NAV 2013, but I am sure, that there will be LOT of blog articles in next days, because the NDA for MVPs about NAV 2013 beta was lifted. Thus, watch the blogs of my fellow MVP friends for more info...

As you can see, NAV 2013 is really big jump, may be bigger than NAV 5 to NAV 2009 jump.

Posted by kine | with no comments
Filed under: ,

Directions EMEA day 1

Ok, it is late and I am tired. But I will pack the day into few sentences:

  • Page preview in page designer – interactive preview of the page directly in C/SIDE, clicking on the object in the page select the corresponding line in the designer or you can open properties for the object (action/field)
  • “Find” function is back – you can again instantly search for specific data in the actual column
  • Variable filters – when filtering in the RTC, you can use “variables” like “%mycust”, which will be “expanded” to e.g. “10000|20000|300000” based on your customer selection. This replacement and expansion is handled with special codeunit in NAV, thus you can add own variables (some other default are already there like “%today”). Saving view with this variable in filter will save the filter including the variable, thus by changing the data will have effect to the saved view (each time when opening the view the variable is replaced with the values)
  • New tool to quickly setup the new company (something like RIM). Partners could add own packages, which will add new settings.
  • Cloud-RTC-debugger  -- all is working together.
  • Query and OData – new way how to get the data from NAV to outside and consume them, e.g. in PowerPivot. Query generate complex SELECT statement on SQL with possible JOINS, GROUP BY and preselected set of fields. This could be consumed through OData protocol (something like RSS feed) which could be filtered.
  • New version of NAV should be released ONCE per YEAR! – partners needs really think about this and how to keep all customers up-to-date!

And short list from Waldo’s presentation:

  • Remote Desktop Manager
  • smtp4dev (www.nav-magno.be)
  • Codegenius
  • Mantis bug tracker
  • iFacto Revision

Ok, going into bed. Regarding details, I think more blog articles are needed, but right now, I still do not know how deeply I can go and not hit the NDA… you need to wait for the correct time.

Posted by kine | with no comments

Garbage Collector in NAV 2009

Today I learned one new thing:

Garbage collector in NAV 2009 is set to DISABLED by default. Do not ask me what does it mean and why it is disabled. I do not know. Regardless the value DISABLED, this settings just means that Workstation mode is used for GC. Microsoft NAV team have learned, that by enabling it, you can speed up the NAV Server! Are you asking how you can enable it? It is easy, you need only to add this into the Microsoft.Dynamics.NAV.Server.exe.config file:

<configuration>
   <runtime>
      <gcServer enabled="true"/>
   </runtime>
</configuration>

It is standard Dot.NET config parameter. What I have noticed when I just googled this parameter, that it could (and probably would) raise memory consumption of the process. Of course, because if I understand it correctly, it will not release the memory of created object immediately, after the object is not used anymore, but only when the GC is started (e.g. there is no enough free memory or max time between runs was hit). But this “not releasing” leads to better performance. But, again, this is just my understanding of the problem. I can be wrong. Based on the comment from Per, the difference is, that Server GC will be used instead workstation GC, which means separate threads on highest priority for the GC, instead running GC in context of user thread. And this means using all available CPU cores etc. and this leads to better performance when doing GC, because during GC run the threads are suspended. But still, that the performance is better, is true.

Please, post into comments your experience with this setting.

I want to thank to Michael Nielsen for this info…

 

(Edited 7:08 CET 25.4.2012)

Posted by kine | 1 comment(s)

Possible new way to install NAV 2013

Just now, I am in Rome, waiting for tomorrow, when Directions EMEA 2012 begins. Whole Directions will be somehow connected to NAV 2013, and it seems that it will be beginning of blog articles about NAV 2013 and new technologies/functions inside it.

 

ClickOnce

First new feature you can use in connection with 2013 is ClickOnce install. This way of installing and distributing of applications exists since .NET 2. But it was not possible to use it for previous versions of NAV. Now, with upcomming NAV 2013, partners could prepare installations for their customers, which includes all what is needed, like addon libraries and custom client settings.

How it works?

Partner prepares the installation (set of easy steps, which could be automatized – it is out of scope of this article right now), publish it somewhere and send the URL to the customer. Customer just by opening this URL will install the RTC, which will be preconfigured e.g. to connect to his NAV server. Partner than can update the installation e.g. by newer version of addon. This update is automatically installed into the customer’s computer when he click the NAV icon. It means much less effort to keep all customer’s clients up-to-date, no problems with distributing the addons. This is very good in days, when it depends on which build is using each customer and user. On user’s computer there could be more versions/variants of the app installed side by side, each with own config.

Limits

But! There are some limits for this feature in connection with NAV:

  • Prerequisites are not automatically installed
  • The install process have no access to the registry (e.g. when addin installation needs something to write there)
  • You cannot run the client.exe directly from outside (ClickOnce is using different way to run the app to check for the updates first etc.) and thus you cannot pass runtime parameters to the client
  • You cannot use the URLs to run the client
  • It is possible to deploy only RTC this way

For me, it is something similar to App-V technology, but much more easy to create the installation and you do not need any special client to be able to use it (and any special server). But the “installed" app is somehow “encapsulated” and thus not working as standard client installed on the PC.

Still, it is worth it for partners, which are deploying e.g. cloud solutions or simple solutions, where these features are not used.

I recommend to read more about ClickOnce e.g. here: http://msdn.microsoft.com/en-us/library/t71a733d.aspx

For using ClickOnce with NAV, there will be tools distributed together with NAV 2013 to make the process as easy as possible.

I hope, that future will drop the limits in some way, because it will be cool to have this way together with possibility to install the dev. environment and possibility to use links to run the client.

Posted by kine | with no comments

E-Book Give away winners

Hello all,

thanks to all for the e-mails regarding the e-book give away. I made small overview of most hated/loved feature of NAV 2009 and feature of NAV “7” you are looking for most. I must say, that from the e-mail I can see, that expectation from NAV “7” are very “biased” by rumors and wrong information about what will be in NAV “7”. There are not much info released, but I highly recommend to spend some money and be on events like Directions (Directions EMEA), Convergence, or NAV TechDays. You will get much more info and you will not wait for something, what will not be in NAV “7”.

There is graph of the result:

image

As you can see, most loved features are WebServices, Addins, .NET Interop and new Reporting (I agree!). Most hated are Reporting and Debugger. And you are looking forward the new Debugger, Queries and web client. Based on my knowledge, if I look at the list of features you hate on NAV 2009, I must say that NAV “7” is step in correct direction in most areas.

That’s the result of my small “research” and I hope, that the winners of the e-book will hate NAV 2009 less after they read the book Veselý obličej.

 

The winners are:

  • Márton Nagy
  • Martinez Gonzalez Chemanel
  • Peter Rozmus

Congratulation!

For rest of you, do not hesitate and use the Packt Dynamics Mayhem capaign to buy your copy for lower price.

I hope that I meet you e.g. on the Directions EMEA in Rome!

Posted by kine | with no comments

“Microsoft Dynamics NAV 2009: Professional Reporting” book give away

Thanks to the kind people of Packt Publishing, I'm able to give away 3 e-copies of the book “Microsoft Dynamics NAV 2009: Professional Reporting” written by Steven Renders. What you need to do for that? Send me e-mail to kamil.sacek at gmail dot com with these info:

Subject: Book giveaway

Body:

        Your Name:

        What you like and hate most on the NAV 2009 from technical point of view:

        What you are looking for most on NAV “7”:

 

I will randomly select 3 winners which will receive the e-books (deadline for the emails is 23:59:59 5.2.2012 CET). This give away is running on all my blogs together, it means only 3 e-books for all 3 blogs sites I am using…

 

Posted by kine | with no comments

NAVTechDays 2012!

For all technical people around Microsoft Dynamics NAV: Be informed, that next NAV TechDays will be THIS YEAR! Who wants to learn new things and see many interesting tools/applications/hints/tips etc. – mark the date September 27.-28. 2012 in your calendar! Place will be same, Antwerpen, Belgium. Who missed the last conference, do not hesitate and plan your trip! It is a must for everyone to be there at least once… Veselý obličej

Sorry for so many exclamation marks in a so short text, but I am excited…

 

Thanks Luc, I am looking forward it!

 

I hope I will see you all there!

Posted by kine | with no comments

Barcodes “magic” revealed

I just wants to forward you to my hosted articles about the barcodes there and there. I wrote it for the Microsoft Dynamics NAV blog and is focused not so technically, how you can expect from me. But I tried my best. Thanks for the feedback…

Posted by kine | with no comments
Filed under: ,

NAVTechDays memories

I am sitting in Brussels airport and I am waiting for my flight. What to do? Ok, I think that after the TechDays I cannot say „there is nothing to blog about“. Just the opening keynotes were source for many articles about different things in NAV „7“, because they were published there and I can blog about them now. Or I can blog about other great sessions which were presented during these two days. Or I can just blog about people I have met there... Ok, I try to select just few things for you now.

1st subject

First point is, that I want to say „Thank you“ to everybody, who helped to make the NAVTechDays real event. Biggest share on this have Luc, who put most effort, time and I do not know what everything else into this event. And the result was really, really GREAT event. I recommend it to all developers who can attend, to try their best and attend next TechDays, which should be in two years. I hope that the event will continue, because it is only event focused on technical things instead sales blabla.

Thanks to all presenters for their great sessions. What I saw was great. I am looking forward the recordings of the rest.

2nd subject

Now something about the opening keynotes:

Keynotes started with the history of NAV, since the first version. It was good to see all what leads to the current system and that each time the system changed, it lead to another change in the system, because new requirements. And it is good to see, that NAV is still changing, because no change means no future.

After that, people attending this keynotes saw the NAV „7“ RTC klient on the screen, and could notice there, that the menu in the client changed. There was no standard menu as we know it from NAV 2009, but everything was on the ribbon! The ribbon has a tabs as you know them from Office 2010 where all the actions were available. Thus it is much more in line with the office application now and I hope that it will help people to find what they need more quickly.

Another thing presented was the „NAV Sharepoint Framework“. It means that you can now include NAV page directly within your Sharepoint through just using special URL for any page which exists inside NAV, or you can use Sharepoint WebPart to include any NAV page as standard webpart and connect it with other parts on the page. What to use in which case depends on the context. But this is something out of scope of this article. Main point is: you do not need to do any change within NAV to be able to do that! It means, you can make NAV available for anyone within your organization, who needs something within NAV, and do not need full RTC. Very easy, straight forward, simple, quick, effective. Of course, there are some limits, but nothing is unlimited.

Of course, there were many other subjects like NAV „7“ will be 64bit, will support Unicode, etc. But you will see yourself when the recordings will be available.

3rd subject

Last subject in this blog will be something named Partner Ready Software. What does it means? It is initiative, behind which you can find names like Gary Winter, Eric Wauters, Mark Brummel. I highly recommend going through their site and reading more there. I agree with them (of course, not without exceptions). Main thing what I see today as main take away is, that they succeeded in naming different things which are used during the whole lifecycle of partner and that now it could be much easier to discuss different problems , patterns, behaviors and other things, because they could be named. What I remember from the session: atomic development, iHook (fasade), archiving etc. When you read the document, you will find out that many things you are using automatically, will be much easier to describe to your colleagues. It will be easier to share different through about different things with other people, you will be able to describe what and why you are doing. And I hope that all that will lead to better software instead just products. Thanks guys, I am happy that your visit in Prague gave you chance to start this work. I do not know if you were inspired by Czech girls, beer or something else, but it doesn’t matter, you have started great thing and I hope, that it will give us all good fruits... J

Ok, that’s all what I had on my mind. I am looking forward the recordings. In between you can look to some photos here.

Do not forget to look for info about next NAVTechDays and do not forget to be there next time!

Thank you, Luc and everyone, who helped to make this event so great!

P.S.: Article posted with few days delay, when I am sitting in my office preparing for the day.

Posted by kine | with no comments

Small tip about database triggers in NAV 2009

Just very short article: do you know that the database triggers “OnDatabaseXXX” in CU1 are working for object table too if you return correct flags in “GetDatabaseTableTriggerSetup”? Mrkající veselý obličej

Posted by kine | with no comments

Overlooked new parameter in NAV 2009

It is some time I have noticed one small change which is not described or I never see it in some official documentation (excluding help files). You know the drill when you need to pass temporary table:

You pass it as parameter by reference, or you copy the records one by one.

Sometime you will use the first, sometime you will use the second. Now, you have new possibility:

Rec.COPY

You are thinking: “Oh, wait, it is not copying the data inside, only filters etc.!”

It is not true anymore. If you look into the Symbol menu to this function over some record variable, you will notice that there is new second parameter with name “ShareTable”. And this is it. If you set this parameter to “True” and you will call this COPY on some temporary table, the record variable to which you are copying will share the temporary table with the first variable! It means you see same data, but you have another variable to iterate and modify them!

Example:


TempVar1.DELETEALL;
TempVar1.Code := 'TEST';
TempVar1.INSERT;
TempVar2.COPY(TempVar1,true);
TempVar2.FIND('-');
MESSAGE('%1',TempVar2.Code);

TempVar1 and TempVar2 are temporary records e.g. over table 3. EASY! If you forgot to set the temporary on one of the variables, you will get this error in run time:

The COPY function can only be used with the shareTable argument set to true if both records are temporary.

Quote from the on-line help:

ShareTable

Type: Boolean

Specifies whether the function creates a copy of the record or creates a reference to a temporary record.

If FromRecord and Record are both temporary and ShareTable is true, then the COPY function does not create a new copy of the record. Instead, the COPY function causes Record to reference the same table as FromRecord.

The default value is false. If you specify false, all records are copied to Record from FromRecord.

As you can see, there is one mistake in the description: if the parameter is false, regarding the online help it should copy the records. But THIS IS NOT TRUE! In this case, the same example with false parameter will give you same result (only the table will be another copy, not the same one), but the real result is error, because the table in TempVar2 is empty!

I think that many of you didn’t notice this change, which could help us to create much better code. Sometime even the standard objects are using arrays of record variables to solve this. Now, you can use different variables and set them to same instance of the temporary table by just using COPY on them.

Those little things makes me happy each time I find something like that.

Posted by kine | with no comments
Filed under: ,

NAV TechDays 2011

To all you interested in newest things around NAV and everyone interested in face to face meeting with people around Mibuso.com and Microsoft Dynamics NAV product group: do not forget to register to NAV TechDays 2011. It is time to get your air tickets, hotel reservations and travel plans. Do not miss this possibility to be part of the NAV World and be in contact with all the people around. Do not hesitate and use this event to pass your ideas, questions and other things to the correct people and learn something new from the NAV top X presenters.

See you there!

Posted by kine | with no comments

Dynamics NAV 2009 and SPNs

Everyone, who once tried to install NAV 2009 Server to separate computer than MS SQL Server, needed to solve one “mystery”: how to set the SPNs correctly. Today I will try to uncover the fog around the SPNs and how to set them correctly. At first, I am not expert in this area too. I will try to describe everything as “I understand it”. It means, it could not be fully true, but it works for me. I know that there are already different articles about NAV and SPNs but I have found them as a not fully understandable or I missed some parts in them. Thus I will try to describe all what you need to know…

What is SPN?

SPN = Service Principal Name

As you can see from the name, SPN somehow identifies some service. Name is created from service/instance name and the host name in most cases. It means:

MSSQLSvc/server.contoso.local:1433

identifies service with name MSSQLSvc (name for default instance of SQL server) running on server.contoso.local using port 1433. It means same service on another server have different SPN. Another service on same server have different SPN too. BUT! The server name depends on the way, how you are calling the service. It means, if you use servername “server” to connect to the SQL, this SPN will not work! You will need different SPN:

MSSQLSvc/server:1433

It means that parameter “DatabaseServer” in CustomSettings.config for NAV server must use the naming you have used when creating the SPN. If you use different name, you need to create the SPN for it. Same applies when calling NAV webservices – if you use http://server/xxx or http://server.contoso.local/xxx it needs different SPNs to be set. Else it will not work.

To be able to use the service with Kerberos, each SPN must be registered with one account object of the domain. It means that specific service instance is connected with one specific domain account, under which the service is running. It means that if the service (e.g. MS SQL) is running under account “contoso\SQLServer”, the SPN must be registered with the account “contoso\SQLServer”. This is done through command prompt by running this command:

setspn –A MSSQLSvc/server.contoso.local:1433 contoso\SQLServer

If you change account under which the service is running, you need to re-register the SPN with new account. There cannot be one service registered with two accounts, else Kerberos will not work for this service! If you want to list all services registered for specific account, you can use this command:

setspn contoso\SQLServer

If you want to see all SPNs for specific server name, you can use this command:

setspn –q */server.contoso.local

By using these commands you can check your settings and correct it if you need.

Using service account

in previous text I was describing how the SPN works and that they are registered with the domain account under which the service is running. But what if you are using system account like “Network service” or “Local service”? It is not domain account…

In this case, you need to use the server domain account. It means that you will use “contoso\server$” as a account name. Each computer connected into the domain have account in format “<domain>\<computer_name>$”. If you don’t forget this, it is much easier to set everything to work correctly.

Chain of trust

If you need to be able to pass Kerberos authentication between services, you need to create the chain correctly. Every service in the chain must have correct SPN registered with correct account. Than you need to set some additional properties of the domain account which will pass the authentication to other services. In case of NAV it means that you need to allow the account, under which the NAV server is running, to pass the authentication to the SQL server. But I think that this is the easiest step. You need to open properties of the account through mmc snap-in console “Active Directory Users and Computers”. You can find the new tab “Delegation” on which you need to set to which services could this specific account delegate the authentication. You can set it to “all services” or only for specific one. But because this is easy to set (you just select specific server and pick the correct service from list of all available services registered on specific server) I will not go deeper into this. But do not skip this step, else it will not work…

Tools to simplify the process

If you have still problems to find correct commands to set all what you need, I recommend to use DelegConfig v2 (beta). You just add this application to some IIS (if you use different server than where you are running NAV server, set the application pool for this application on the IIS to some account which have enough permissions to read data from Active directory) and open the site. There is wizard, which will take all info from you (Front-end is NAV Service – service name is the instance name you are using in NAV server – DynamicsNAV by default, back-end is the SQL) and the tool will shows you the report with all information you need. If there are missing SPNs, it will give you the commands you need to create them. If there are duplicities or strange records, it will give you commands to delete them. If this tool tells you that everything is OK, trust me, it will work. If there is some error (not the one that the tool have not enough permissions to read all necessary info, this means that the used account have not enough permissions), the delegation will not work and you need to set everything the tool tells you.

Example

Configuration:

Dynamics NAV server instance name TESTNAV on server NAVSERVER.contoso.local under “Network service” (incl. webservices)

SQL Server running on SQLSERVER.contoso.local under “contoso\SQLServer” account.

We are using both naming conventions to connect to the servers, FQDN and NetBios names.

Needed SPNs for NAV Server:

setspn –A TESTNAV/NAVSERVER.contoso.local:7046 contoso\navserver$

setspn –A TESTNAV/NAVSERVER:7046 contoso\navserver$

SPNs for NAV WebService:

setspn –A HTTP/NAVSERVER.contoso.local contoso\navserver$

setspn –A HTTP/NAVSERVER contoso\navserver$

SPN for SQL:

setspn –A MSSQLSvc/SQLSERVER.contoso.local:1433 contoso\SQLServer

setspn –A MSSQLSvc/SQLSERVER:1433 contoso\SQLServer

Delegation settings:

On “contoso\navserver$” account must have enabled “Trust this computer for delegation to any service (Kerberos only)” or “Trust this computer for delegation to specified services only.” and the MSSQLSvc service on SQLServer must be selected as trusted service.

Conclusion

If it doesn’t work, check that you are using the correct name and port for which you have registered the SPN, that the service is running under account for which you have registered the SPN, that there are not duplicities (setspn –X) and that the account is trusted for delegation to correct services. If you do not still know where is the problem, try to use the DelegConfig tool to check all for you.

Posted by kine | with no comments

NAV Service Tier management tool for NAV 2009 R2

Today I have finished first version of my remake of the NST Management application. Now, completely done inside NAV!

I wanted to test the DotNet interop in NAV 2009 R2, and I have found, that it works, and it works without any problem! Because I already knew what I needed to do the NST management, it was easy to replicate the app from C# into C/AL. If you look at the code, it is easy! Just few lines of code to read all available SQL server, to read databases on the SQL server, to show folder selection dialog, to read and modify XML file, to run external command and wait for result, to read list of services, start and stop them etc. You can be inspired with that for your own management tools.

 

NST_Mgt_NAV2009R2

Usage of this tool is only on your own risk. There are no checks if you are removing default services etc. but you can add them if you want.

 

I hope that it will help you to adopt the new RTC with all the cool features in it, and that it will be much easier for you to maintain your infrastructure.

The objects could be downloaded here.

Requirements:

NAV2009R2 RTC

Admin permissions on the managed server

Sending SMS from Dynamics NAV with 5 lines of code

After long time, I have found few minutes (ok, hour and something…) to test one idea I had. It is not long ago, when we switched our Exchange from older version to version 2010. Because I am using Windows Mobile 6.5 on my phone, I have noticed the new possibility to synchronize SMS from/to mobile with exchange/outlook. Bingo! If I am able to create the item in outlook from within NAV (and yes, I am able, I can create emails etc.), I can send SMS from NAV in this way. Easy!

What you need:

Outlook 2010

Exchange 2010

NAV (any version supporting automations…)

Mobile phone with Windows Mobile 6.1 (with some update) or 6.5

 

Step 1

Setup the mobile to synchronize all with the exchange, mainly the SMS. Just follow standard procedure, this blog is not about setting up the mobile phone…

Step 2

Create code in NAV, which will send the SMS. It is easy:

SendSMS(ToNumbers : Text[30];Body : Text[1000])

begin
  if ISCLEAR(OutlookApp) then
    CREATE(OutlookApp);

  MobileItem := OutlookApp.CreateItem(11); //11 – SMS, 12 – MMS
  MobileItem."To" := ToNumbers; //e.g. +420666777555
  MobileItem.Body := Body;
  MobileItem.Send(False);
end;

Where:

OutlookApp    Automation    'Microsoft Outlook 14.0 Object Library'.Application   
MobileItem     Automation    'Microsoft Outlook 14.0 Object Library'.MobileItem   

Step 3

Call the function where you need. You need to just run it under profile, which have outlook set to syncing SMS with phone. It will create the sms, and after the sms is synced into the mobile phone, the mobile phone will send the SMS for your wherever you want. If you want to have central sending machine, use the NAS or WebServices to send SMS based on some queue…

Conclusion

As you can see, you do not need to pay for some 3rd party service. You only need some mobile phone with good tarif. Of course, this is not good solution for some bulk sending, but for some standard notifications it is suitable.

Do not forget to make some maintenance of the outlook account, like deleting old sent items etc. You can do it through some code in NAV or may be somehow on the exchange.

And yes, you can read the incoming sms in similar way, just read the items from the outlook.

Some examples of usage:

Sending SMS to admin when session limit is reached (using NAS).

Sending SMS to customer when order is prepared to ship.

Generally: sending SMS when <some action> in NAV happen. :-)

Posted by kine | with no comments

Universal WPF Addin for NAV v1.3

Hello everybody

After some time, there is new version of my UniWPF addin. Now with possibilities to dynamically add and remove elements, read their properties and bind their properties together with some additional calulations (using Xaml LambdaConverter).

Usage:

This addin is now ready to be used e.g. for creating touch screens for POS and other systems dynamically, to display dynamically created buttons, drawings, pictures, media (you can easily play some video inside…). All the properties of WPF are used, thus the content is automatically resized if all is set correctly inside the XAML (data binding the controls between each other). Example is the calculator with some demo functions using all aspects of the addin.

 

What’s new in v1.3

  • In the Element you can now use the Parent attribute to select parent element. All elements defined by the XAML will be added as children of this parent. Parent must be descendant of Panel class.

  <Element Parent=”ParentName”>
    //there is XAML describing the controls which should be added into the addin, the XAML must include correct name spaces
  </Element>

  • There is new element with name DelElement which allows you to remove selected element from selected parent.

    <DelElement Parent="parentname" ObjectName="objname"/>

  • When binding attributes of elements together, you can now use the LambdaConverter to manipulate the value. Example is the ellipse in the added button, which is binded to the size of the button. Without the converter, the size of the ellipsis would be each time same as the size of the button, thus leading to not nice result. But when we define the converter like:

<Grid Name="mygrid" Grid.Row="1" Grid.Column="2" Margin="2,20,2,2"
  xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation
  xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
  xmlns:XamlConverter="clr-namespace:XamlConverter;assembly=XamlConverter"
  xmlns:System="clr-namespace:System;assembly=mscorlib">
  <Grid.RowDefinitions>
    <RowDefinition Height="50*" />
    <RowDefinition Height="50*" />
  </Grid.RowDefinitions>
  <Grid.ColumnDefinitions>
    <ColumnDefinition Width="61*" />
    <ColumnDefinition Width="70*" />
    <ColumnDefinition Width="69*" />
  </Grid.ColumnDefinitions>
  <Grid.Resources>
    <XamlConverter:LambdaConverter x:Key="smaller">value-10</XamlConverter:LambdaConverter>
  </Grid.Resources>

we can now bind the size of the ellipsis with the size of the button with calculation like this:


<Ellipse Width="{Binding ElementName=mybutton4, Path=ActualWidth, Converter={StaticResource smaller}}"
  Height="{Binding ElementName=mybutton4, Path=ActualHeight, Converter={StaticResource smaller}}" Stroke="Black"\>

This binding takes the value of ActualWidth attribute of the mybutton4 element and pass it into the converter with name “smaller” which will subtract 10 from the value and return the result. You can define own converter for what you need. Notice, that the namespace must be defined in the XAML to tell parser where to look for the class LambdaConverter used to define the converter. This class is defined in assembly XamlConverter, which is attached to my addin.

If you use correct namespace definition, you can define any class in the XAML. Grid is just a class from the default namespace. Button is just another class from the namespace. If you create own assembly with own controls, you can use them in a same way. Just define the namespace and add appropriate elements into the XAML.

Demo

I am still using the horrible calc demo, but I am planning to create some more complex demo in future to show the possibilities of the addin in better way. If you want to help me, I am open to collaboration.

You can download the files there.

More Posts Next page »