NEW: Dynamics Super-User Training Course

Are you an experienced Dynamics user? Would you like to become a Dynamics Super-User?

If your answer is yes then take a look at our brand new Dynamics Super-User training course, that can give you the skills you're looking for.

This course is specifically aimed at providing the more experienced user with an appreciation of how to perform presentation and configuration of the Dynamics NAV user interface.

This allows you to control what other users can see and do, as well as how you can track those changes.

Interested? How about coming along to one of our training days?

The next upcoming training days are:

  • 24th May
  • 12th July

For more information take a look at our Dynamics Learning page, where you can book with us today, as well and see what other training courses we have to boost your work life.

Working with XML in PowerShell

PowerShell variables are very accommodating creatures. You can assign any value to them and the variable will automatically store it in an appropriate data type. This is great 99% of the time – you can throw the result of any sort of cmdlet at them and leave PowerShell to sort itself out. Having assigned the value to the variable, PowerShell ISE’s intellisense will let you know the properties and methods you can access in the variable’s new state.

For the record, this is called ‘loose’ or ‘weak’ typing. You’ll find a similar approach in other languages, JavaScript or PHP, for example.

One time you might want to consider specifying the type of a variable in PowerShell is when working with xml. Take the following xml:

<root>
    <header>
        <order_no>12345</order_no>
        <line>
            <item_no>ABC</item_no>
            <quantity>2</quantity>
        </line>
        <line>
            <item_no>XYZ</item_no>
            <quantity>5</quantity>           
        </line>
    </header>
</root>

If I load the content of a file containing that xml into a variable with Get-Content, PowerShell will type the variable as a string and give me stringy properties and methods.

String Example

If I declare $OrderXml to be of type [xml], however, I get a different set of properties and methods. Far more useful for selecting nodes, iterating through NodeLists and other essential XML stuff.

Xml Example

The $Line variable even has properties for each of its child nodes, allowing you to access their values directly. This is the corresponding output:

PS C:\WINDOWS\system32> [xml]$OrderXml = Get-Content "C:\Users\James.Pearson\Desktop\test.xml"
foreach ($Line in $OrderXml.SelectNodes('/root/header/line'))
{
    $Line.item_no
    $Line.quantity
}
ABC
2
XYZ
5

NAV Support Hours Now 8am – 6pm As Standard

We’ve all been there, you get in the office early to finish that urgent task, and then your business system is not playing ball. The support line doesn’t open until 9am and so the early start is wasted or worse, the deadline you had to meet for your customer can’t be met.

We also know many of our customer’s work in manufacturing and distribution and that industry doesn’t fit the traditional 9 till 5 routine. Warehouse staff need to know what they are picking when they arrive, to make sure everything else runs to schedule. The world in general is changing and businesses are working more varied hours as they offer more to their customers.

So we decided to do the same – Technology Management have offered 24 hour critical support for several years, but we realised that many of the companies we work with couldn’t justify the cost for the few times they may need some help. Most of those customers just wanted some extra help above and beyond the normal contracted hours.

We took the feedback and extended our standard support hours from 8am – 6pm.

We already have what we believe to be the biggest UK NAV support team, they are dedicated to support so you don’t find you are talking to different people each day. They are also complemented by an experienced developer that is part of the support team, so if a calls need to be escalated in that direction, they’re available (and not pulled off an existing project they are meant to be working on!)

Our priority is to make sure you have as few niggles as possible, but when one crops up we want to make sure you get the help and support you need, even if that is when some other partners are still having breakfast or have packed up and gone home for the night.

Be NAV Happy!

For all our support details go to https://www.tecman.co.uk/Deployment/System-Support/Microsoft-Dynamics-NAV-Support

Software has changed, it’s constantly evolving

Whether its an app on your phone, Facebook, Twitter or you’re favourite website, you can bet that  fairly frequently a new feature or benefit appears. Before you know it that feature becomes the norm and you wonder how you got by without it.

And so it goes on…..

That mindset of constant improvement is a good thing and its great to see it being adopted in more tradition software packages like ERP. The days of huge upgrades every 4 or 5 years that were costly, time consuming and detested by the end users are over. Microsoft Dynamics NAV has been on an annual release cycle for over 4 years now and we see that accelerating as we get a monthly update as well.

As the changes are happening more subtly the requirement for intensive training sessions are disappearing, the interface evolves sensibly so users can see quickly see what’s new rather than being drowned under too many changes at one time.

The world is changing at a rapid pace as well, mobile devices have dramatically changed the way we work on the go. If you had to wait 5 years for an upgrade then you’ll still be waiting for a mobile client for your software long after you bought that Ipad. But an annual release means its there within months of us all realising these tablets could actually make us more productive.

New licencing models have also appeared, the ability to pay for the software on a monthly basis, scaling up and down as your business requires it.

The option of having your ERP software in the cloud is appealing to many progressive business owners, no hardware to worry about or maintain, no huge infrastructure costs just to get the software installed. Just load the client or use your web browser. This again results in updates to the client just appearing in the browser client, no more walking around each PC and loading new client software on it when there’s a change. Huge time and cost saving.

 

Microsoft Dynamics NAV is at the front of the pack when it comes to this new software model. If your on an older version speak to us about getting you up on the current release. Once your there you’ll wonder how you got by without it for so long.

If your current ERP solution doesn’t offer you these benefits, well maybe its time to make switch.

Check out our NAV 2016 resource page with videos, downloads and info sheets to get you up to speed.

http://bit.ly/1Hed5cq

Jet Reports – Using a Field Cache with the NL function can give unexpected results.

The Field Cache in Jet reports is a list of fields that are to be retrieved from a table with the NL function. If the Field Cache is not specified then all fields are returned.

An example without a Field Cache;

=NL("Rows","Item  Ledger Entry")

An example with a Field Cache;

=NL("Rows","Item  Ledger Entry",{"Item No.", “Quantity","Posting  Date"})

In the second example above the Field Cache is the list of fields contained within the {} brackets;

{"Item No.","Quantity",”Posting  Date”}

A Field Cache is mandatory for a table that has no primary key, and is also recommended for a table with a primary key since it speeds up the report and reduces the amount of data.

So what does this all mean in practise and why can it lead to unexpected results?

Consider the following item ledger entries for items in the Dynamics NAV Cronus database;

Figure 1

Entry No. Item No. Quantity Posting Date

1

1000

10

01/04/2015

2

1100

12

01/04/2015

3

1000

8

02/04/2015

4

1120

3

02/04/2015

5

1100

9

02/04/2015

6

1155

25

02/04/2015

7

1000

8

02/04/2015

8

1000

15

03/04/2015

9

1100

6

03/04/2015

If you need a Jet report to list records from the Item Ledger Entry table and have columns for ‘No.’, ‘Quantity’ and ‘Posting Date’ , you could use the following NL function ( together with NF functions for ‘No.’, ‘Quantity’ and ‘Posting Date’) to report the data;

 =NL("Rows","Item  Ledger Entry")

You will get the following results;

Figure 2

Item Quantity Posting Date

1000

10

01/04/2015

1100

12

01/04/2015

1000

8

02/04/2015

1120

3

02/04/2015

1100

9

02/04/2015

1155

25

02/04/2015

1000

8

02/04/2015

1000

15

03/04/2015

1100

6

03/04/2015

This is ok, however if you have a large number of records to retrieve you may choose to use a Field Cache to reduce the amount of data retrieved from the database by only choosing the fields that are required for the report.

Instinct would be to change the NL function to be as follows;

=NL("Rows","Item  Ledger Entry",{"Item No.","Quantity","Posting  Date"})

Using the function above will give the following results;

Figure 3

Item Quantity Posting Date

1000

10

01/04/2015

1100

12

01/04/2015

1000

8

02/04/2015

1120

3

02/04/2015

1100

9

02/04/2015

1155

25

02/04/2015

1000

15

03/04/2015

1100

6

03/04/2015

Note that a record for Item 1000, Quantity 8 and Posting Date 02/04/2015 is missing.

This is because the Field Cache is used and the NL function will only report the unique combination of the fields in the cache, in our case this is "Item No.","Quantity","Posting Date".

From Figure 2 above the following records are ‘repeated’ and the NL function will only report one of them;

Figure 4

Item Quantity Posting Date

1000

10

01/04/2015

1100

12

01/04/2015

1000

8

02/04/2015

1120

3

02/04/2015

1100

9

02/04/2015

1155

25

02/04/2015

1000

8

02/04/2015

1000

15

03/04/2015

1100

6

03/04/2015

To avoid this you can add a field (or fields) to the Field Cache that form the primary key for the Dynamics NAV table, in our case this field is ‘Entry No.’ Adding this field to the Field Cache will report all records, this is because the Entry No. is unique for each record.

Our Jet NL function will then be;

=NL("Rows","Item Ledger  Entry",{"Item No.","Quantity","Posting  Date","Entry No."})

So how do I know which field(s) forms the primary key for a Dynamics NAV table?

This information can be found from the table information in Dynamics NAV.

In RTC Client use the ‘About This Page’ option to list the table fields information;

Image-001

 

Image-002

The field(s) at the top of the list with the suffix (PK) are those that form the Primary Key, in the example above this is ‘Entry No. (1) (PK)’

In Classic Client use the Sort option to list the table keys;

Image-003

The field(s) shown on the first line are those that form the primary key. In the example above this is ‘Entry No.’.

Technology Management Web Panel Add-in.

Part II – NAV 2015 Windows and Web Client custom controls.

In my last blog describing the Technology Management On-Screen Keyboard Add-in I promised to come back with another one about adding custom controls to Microsoft Dynamics NAV 2015 Web and Windows clients which I will be covering below.

I think most developers have been faced with the situation when there was a need to force the control to behave or look in a certain way. It used to be quite easy in previous versions of Dynamics NAV: place the control where you want, set the font, size and colours. It is not as easy any more. You would need an Add-in to achieve that today. And even though there are number of blogs and posts throughout the NAV community describing how to create an Add-In like that, it will still require a fair amount of time to develop one from scratch. And this in itself is usually a valid reason to tell the customer ‘No, I am afraid we cannot do that’ and try to persuade them to use a workaround.

But what if ‘No’ is not an option? What if it is critical to have this indicator, or a big red button right in the centre of the screen?

Well, in this case you will have to do the following:

  1. Create a C# class library object to hold the interface Add-in to establish communication between NAV C/AL and the JavaScript Control Add-in, sign, compile it and copy the resulting .dll into the Dynamics NAV Service and Client Add-in folders (you do not really need to put the .dll into the client folder when you will be deploying the solution, but it is critical when you develop). The code itself is nothing very clever, something like that:

    using System;
    using Microsoft.Dynamics.Framework.UI.Extensibility;
    using Microsoft.Dynamics.Framework.UI.Extensibility.WinForms;

    namespace Microsoft.Dynamics.Framework.UI.Extensibility
    {
       public delegate void WEBApplicationEventHandler(string msg);
    }
    namespace TestWebPanel
    {
       [ControlAddInExport("MyWebPanel")]
       public interface IWebPanel
       {
          [ApplicationVisible]
          event ApplicationEventHandler ControlAddInReady;
          [ApplicationVisible]
          void BuildHTML (string html);
          [ApplicationVisible]
          event WEBApplicationEventHandler SendMsgToNAV
       }
    }

    Each event will be exposed to NAV and will be visible as a trigger within the page containing the Add-in like below.

    Triggers

    If you do not see those after adding the control add-in to the page, then there is something wrong with the .dll.

    The void represents the JavaScript function that can be called from within NAV by reference by its name like CurrPage.TestPanel01.BuildHTML(xxx) where TestPanel01 is the name of the Add-In control, and the BuildHTML is the function declared in the JavaScript code below. In essence the C# object we create is a bridge between NAV and the JavaScript.

  2. Create a JavaScript file containing core communication functions to:

    – Notify NAV that the control is ready:

    function Initialize () {
       Microsoft.Dynamics.NAV.InvokeExtensibilityMethod("ControlAddInReady",null);
    }

    – Nest desired HTML code into the page:

    function BuildHTML(html){
       document.getElementById("controlAddIn").innerHTML = html;
    }

    – Communicate feedback back to NAV. In this example the function will tell NAV which control is calling and its new value (for example to call relevant field validation logics).

    function callNAV(controlId,passValue){
       message = passValue?(document.getElementById(controlId).value):””
       navMsg = "<control>";
       navMsg += "<id>" + controlId + "</id>";
       navMsg += "<value>" + message + "</value>";
       navMsg += "</control>";
       Microsoft.Dynamics.NAV.InvokeExtensibilityMethod(‘SendMsgToNav’,[navMsg])
    }

  3. Ensure the Manifest.xml file is set to allow resizing so that the HTML panel we build could be rendered.


    <VerticalStretch>true</VerticalStretch>
    <HorizontalStretch>true</HorizontalStretch>

  4. Register the Control Add-in in NAV.
  5. Add the Control Add-in to the page.
  6. Add C/AL code describing your control (basically build an HTML content of your Control Add-in) and pass it to the Control Add-in through relevant JavaScript function call (CurrPage.TestPanel01.BuildHTML(HTML), where HTML is a BigText variable containing the HTML description of the control or controls to add).
  7. Add the C/AL code to the ::SendMsgToNAV trigger to process the call from the Add-in.

It is obvious that even as condensed as possible, this is quite an endeavour if all you need is a big red button, or an indicator.

Our Web Panel Add-in allows C/AL developer to add a fully customizable control to a NAV page in pretty much the same manner described above but in a simplified way.

  1. Copy the .dll into the folders and import the objects.
  2. Run the installation routine which will register the Add-in.
  3. Add the Add-in to your page and add a control with a single line of code which will not require any HTML or Add-in knowledge what so ever.

This generic Add-in consists of the same three major parts:

– Functions and libraries containing HTML control definitions;
– JavaScript functions that nest the HTML code into the page and ensure communication between HTML control and NAV;
– C# interface allowing NAV to communicate with above JavaScript functions.

It already contains a number of functions that will allow you to create controls without having to develop your own HTML code and these libraries are being extended with every release.

So, whether it is a green/red indicator, ribbon of bespoke buttons or a role-centre-alike KPI panel hanging from the office ceiling – they can all be added using our Web Panel Add-in. And if you feel adventurous, you are most welcome to create a similar Add-in yourself, as now you should have everything you need for it.

Some useful external resources that might help enthusiasts are:
https://msdn.microsoft.com/en-us/library/dd983804%28v=nav.80%29.aspx
http://vjeko.com/categories/control-add-ins

OutOfMemoryException When Running Dynamics NAV Reports

When you are using the Windows client for Microsoft Dynamics NAV and run a report the dataset is built by the server and piped across the network to your client. Your client then renders the dataset into the tables, images, charts etc. on your report.

If you are running a particularly data-intensive report or a report for a lot of records e.g. an invoice report for hundreds of invoices the dataset can become too large for the server / client to handle. In which case you’ll see this message:

image

System.OutOfMemoryException. Great. What are you supposed to do about that?

Basically you need to reduce the amount of data that needs to be passed between the server and the client. For example, if you passing a lot of rows to the report but only ever displaying the totals you could calculate the totals in the dataset designer and only pass the results to the report.

Before you start going going through your dataset with a fine-toothed comb check if you are passing any images from the dataset to the report e.g. the Picture field from Company Information. If you are, you might be passing it in every record of the dataset. View the dataset with Help, About this Report from the report preview.

image

BLOB fields (which images are generally stored in) which show as asterisks in the dataset viewer.

Got an asterisk in every row? That means your picture is being passed for every row in the dataset – greatly inflating the size of the dataset and making it more likely you’ll encounter the System.OutOfMemoryException.

Asterisks = evil.

Is the picture different in different rows of the dataset or is it always the same picture?

If the latter, you only need pass it once. Create a global boolean variable e.g. “LogoOutput” and add some code like the below in the first dataitem of the report:

 

IF LogoOutput THEN 
  CLEAR(CompanyInfo.Picture)
ELSE
  LogoOutput := TRUE;

 

This will ensure that the picture isn’t passed in more rows than it has to be. Your image control then needs to know which record of the dataset to find the actual image in, like this:

=First(Fields!CompanyInfoPicture.Value, “DataSet_Result”)

i.e. regardless of whatever grouping you have in the dataset, always fetch the picture from the first record in the dataset.

Not only will this avoid the out of memory exception, but you should also notice your reports loading the rows faster (watch the progress of “Rows received” while the report is running).

Double Win.

Select your NAV module when starting the Powershell ISE

Those of you familiar with Powershell (and if you’re reading this, you’re interested in NAV & you’re remotely technical then you really should be) will know that the Powershell ISE is nearly always a superior environment. With scripting, Intellisense and the Commands explorer life could not be easier as a Powershell user – the commands are practically written for you.

But there has always been one shortcoming for me – writing ‘Import-Module’ every time I start a new instance of the environment. Even worse, having to potentially do so twice for NAV 2015.

But I have an answer for you all.

The more adventurous Powershell users out there are probably already with the concept of a profile script (details here)

I’ve been using this myself for a while now, but always found it irritating when I needed to administer on 2013/2013 R2, as I’d have to remove the auto-loaded 2015 modules & then import the appropriate NAVAdminTool. Now when I open Powershell I’m presented the following:

image

I press the button (or if I’m feeling particularly sumptuous I use keyboard shortcuts from the Alt key) and Powershell will import the modules for me.

In order to attain this for your own install of Powershell, you’ll need to copy the Powershell Script found in this zip file. Save this Powershell Script to

C:\Users\[your account name]\Documents\WindowsPowerShell

then open up Powershell & run the following command:

if (!(test-path $profile ))
{new-item -type file -path $profile -force

Now, whenever you open up the ISE you’ll be given the option to select which version of NAV module you require.

Create a new Custom RDLC Report layout:

Many reports in Microsoft Dynamics NAV 2015 are based on RDLC. In previous versions of NAV users had not been able to customize RDLC based reports. In Microsoft Dynamics NAV 2015 the platform changes to support tenant-specific custom Word layouts. Reports in NAV 2015 can now be edited in Report Builder.

Create a new Custom RDLC Report layout

Select Sales Invoice Report 1306 from ‘Report Layout Selection’ page

Department/Administration/IT/Administration/Reports/Report Layout Selection

Find Report 1306: Sales – Invoice. The RDLC is currently the selected layout.

Select the Function ‘Custom Layouts’ in the Ribbon

image

Create new ‘Custom RDLC Report layout’ based on Sales Invoice Report 1306

Select New and then select ‘Insert RDLC Layout’

image

We can now give it a description

image

In the example below I have given it a description ‘My custom RDLC Report’

image

Edit the RDLC Report layout

We can now edit the RDLC Report layout. Select ‘Edit Layout’

image

The report builder open in Microsoft SQL Server Report Builder

image

Once the report opened we can edit the report. Cosmetic changes can be done and in my example below I have done the following changes:

· ‘Customer Address’ fields changed to Red and Bold

· ‘VAT Registration No.’ changed to Bold

· Remove the field ‘Company Giro No.’

· Moved the Company Bank Name one field lower

· Changed the background colour where the field is empty

· Changed the background colour for the columns to light blue

image

The report changes had been completed and we can now save the changes.

image

We can also select to save the report changes by selecting ‘Yes’ on the next warning message to import the changes into Microsoft Dynamics NAV 2015.

image

 

Test the new custom RDLC Report layout

The report can now be tested and made active. The changes can now be verified when selecting the function ‘Run Report’. Note that the report is still inactive and will not be available for the users.

clip_image002

Select Preview

clip_image004

I can now see all the changes that I have made to the report in the report builder BUT the changes is not yet visible on the actual documents.

image

Make the new Custom RDLC Report active

Once the report had been tested and all the changes are completed, the changes can be implemented. I am now back on my Report Layout Selection Page and I select Custom Layout in the field ‘Selected Layout’

clip_image008

The Custom Report Layouts Page opens and I can see my custom report layout. I select OKclip_image010

When the page close I can now see that my report layout is the selected layout.

clip_image012

When printing a Sales Invoice, the report changes will be effective in the live database.

clip_image014

Microsoft Dynamics NAV is a business management solution from Microsoft that is quick to deploy, easy to use, and has the power to support your business ambitions. Please do not hesitate to contact Technology Management for more information.

How to configure and use background posting in Microsoft Dynamics 2015

In previous versions of Microsoft Dynamics NAV, multiple users could only process one Sales Order at a time and this caused delays when multiple users posts Sales Orders at at the same time. In Microsoft Dynamics NAV 2015, Job Queues are an affective tool to schedule the running of business processes in the background. By setting a background posting routine, postings can be placed in a queue for processing in the background.

Alternatively you may want to schedule postings for hours when it is convenient for your company. It may make sense in your business to run certain routines at a quiet time or after office hours.

Job Queues in Microsoft Dynamics NAV 2015 enable you to specify, request, and control when certain processes are run, such as the processing of a report or executing a codeunit. You can enter your requests for the execution of a report or a codeunit in the Job queue entries page. When the report or codeunit finishes, Microsoft Dynamics NAV 2015 records the event in the Job Queue Log Entries page. You can then use, for example, Job Queues with email logging so that it requests regular entries in this table. Microsoft Dynamics NAV 2015 also inserts a record into the Job Queue Log Entry table to record that it has processed a Job Queue Log Entry.

In Microsoft Dynamics NAV 2015 both Sales and Purchases can be setup to schedule background posting for the following documents:

Sales Order, Sales Invoice, Sales Credit Memos, Sales Return Order

Purchase Order, Purchase Invoice, Purchase Credit Memos, Purchase Return Order

 

Both Post and Post and Print can be setup individually. Remember also to setup printers on the NAS Service machine.

 

Setting up Background Posting in Sales and Purchase Setup

  •  You can activate Sales Document posting by selecting the Post with Job Queue 

  • To ensure that you have a dedicated Job Queue for the sales background posting you can provide a Job Queue Category Code. This routes the posting to the correct Job Queue

  • The same applies for Post and Print. It is also setup when you select Post & Print with Job Queue checkbox.

  • The posting will create with a priority of 1000.

  • The Priority Field is used to determine the order of processing the Job Queue Entries. By setting this to 1000 it is easier to allow other jobs to get to the front of the queue

  • Activate the Notify on Success checkbox if you want the user that post’s the documents to be notified about the state of posting.

  • There will be a notification attached to the posted document as well as a notification in the ‘My Notifications Part’ in the Role Center

  • The same steps can be applied to the Purchases & Payables Setup Page

    clip_image002[4]

Figure 1 Sales & Receivables Setup

Setting up a Job Queue

The next step is to setup a Job Queue to run the background posting.

  • In a Job Queue Card you create a new dedicated Job Queue.
  • The Job Queue Category Filter resembles the filter set on the background posting setup. So this Job Queue will only run Job Queue entries with the category SalesPost
  • In the NAS Settings FastTab it is possible to choose which NAS Service which the Job Queue must run on. If we do not select a NAS Service, the Job Queue will run on the same server.
  • When the Job Queue has been started from this session by clicking Start Job Queue action the remaining fields in the General FastTab shows the status of the Job Queue.
  • Now the Application had been configured and it is possible to start posting.

NOTE: The NAS Server has to be restarted to pick up a new post job queue.

clip_image004[4]

Figure 2 Job Queue

Using Background Posting through Posting Documents and Notes

In the next step we will see how the background posting changes the behaviour of the user experience.

  • Posting a Sales Order will create a Job queue entry to be run on the dedicated job queue
  • This will execute the posting routine and if required send a document to a printer
  •  There is a feasible difference in the posting routine since the background posting will notify a user that the order has been sent for posting instead of showing the actual posting steps

clip_image006[4]clip_image008[4] 

Figure 3 Posting confirmation

In the Sales order list it is possible to see the state of posting showing the Job Queue Status field. The list page will show the status of posting.

clip_image010[4]

Figure 4 Sales Order List

If Notification is turned on, it is very useful to add the notes FactBox as well. This is really valuable in cases where the posting for some reason doesn’t finish.

clip_image012[4] clip_image014[4]

Figure 5 Job Queue Notification

In this case there is nothing to post

clip_image016[4]

Figure 6 Sales Order List

Monitoring Background Posting through ‘Find Error Messages’ and ‘Use the My Job Queue Part’

  • It is also possible to see that there is something wrong in the posting on the Role Center.
  • The My Notifications part shows any errors related to the posting.

clip_image018[4]

Figure 7 Notifications on Role Center

  • The same error can be on the found under ‘My Job Queue’ Part

clip_image020[4]

Figure 8 Customize the Role Center

The same error can be on the found under ‘My Job Queue’ Part. Any job queue errors will be readable from the entry in the job queue. Failing Job Queue entries will be displayed in red.

clip_image022[4]

Figure 9 Error Message

Microsoft Dynamics NAV 2015 is a business management solution from Microsoft that is quick to deploy, easy to use, and has the power to support your business ambitions. Please do not hesitate to contact Technology Management for more information.