Cues appear as tiles in the Microsoft Dynamics NAV client that display crucial business data and key performance indicators (KPIs) on Role Centers. Microsoft Dynamics NAV comes with a set of default Role Centers each of which comes with standard cues.
This blog will demonstrate how to create a customized cue table and page that you can include in any role center.
First things First!
In this example, I want to create a cue that will display two KPIs.
- Sales Shipments This Month
- Sales Invoices This Month
In order to do that, we start by creating a table (Sales KPI Cue). As is the case with setup tables. This
table will contain only one record and will have a dummy primary key field. The rest of the fields will be flow fields or flow filters (in our example, required to filter data by date).
Next we add an integer field "Sales Shipments" and we set the following properties:
Field Class: FlowField CalcFormula: Count("Sales Shipment Header")
We do the same for the field "Sales Invoices" where the CalcFormula is:
Count("Sales Invoice Header").
With these two fields we will get all Sales Shipments and all Sales Invoices. A Date Filter needs to be created in order to dynamically filter these number to the periods we need.
Name: Date Filter Data Type: Date FieldClass: FlowFilter
Now, we need to go back and modify the CalcFormula for the KPI fields to include the Date Filter.
Sales Shipments: Count("Sales Shipment Header" WHERE (Posting Date=FIELD(Date Filter))) Sales Invoices: Count("Sales Shipment Header" WHERE (Posting Date=FIELD(Date Filter)))
The Sales KPI Cue Page
Now, that we have created the Sales KPI Cue table, we will need to create the page. Since the page is going to be displayed within a role center page, then the PageType should be set to CardPart.
Inside the root ContentArea, we create a group of type CueGroup and we add the two kpi fields we need to show. Very Simple!
Not There Yet!
We are still not there yet!. We need to add some code in order to achieve two things
- to filter the cue fields for the current month
- to create a record in table if there isn't one (or else you will get a cue that displays no data)
The code should go into the OnOpenPage trigger:
RESET; IF NOT GET THEN BEGIN INIT; INSERT; END; SETRANGE("Date Filter", DMY2DATE(1,DATE2DMY(WORKDATE,2),DATE2DMY(WORKDATE,3)), WORKDATE);
Plug and Play
In order to view the kpi, the created page needs to be added to the required Role Center Page.
To figure out which page is a specific Role Center, check out the Profiles page from the NAV Client. Each Profile is defined with a Role Center Page.