The following walkthrough demonstrates how to add a Cue on the RoleTailored client. A Cue provides a way to graphically show the number of entities in a table and view the entities in a filtered list. For example, the Cue can show total number of open invoices, sales orders, or credit memos. As shown in the following figure, a Cue is an icon that depicts a stack of papers on the page, where the height of the stack roughly indicates the number of entities in an underlying table. A number value on each Cue gives the precise count. The Cue provides a shortcut link to a filtered list page for displaying the entities. You can also add actions to a Cue that open related tasks that a user of the Role Center will typically perform.
About This Walkthrough
This walkthrough illustrates the following tasks:
Roles
This walkthrough demonstrates tasks performed by the following user roles:
-
Microsoft .NET developer.
-
Microsoft Dynamics NAV developer and IT pro.
Prerequisites
To complete this walkthrough, you need:
-
Microsoft Dynamics NAV 2009 with a developer license.
-
All Microsoft Dynamics NAV 2009 requirements met. For more information, see Microsoft Dynamics NAV 2009 SP1 Requirements.
-
Microsoft Dynamics NAV 2009 demo database. The walkthrough uses the following objects:
-
Table 36, Sales Header
-
Page 9006, Order Processer Role Center
-
Page 9301, Sales Invoice List
-
Page 43, Sales Invoice
-
Story
Simon is a software developer who is working for CRONUS International Ltd. He has been asked to add a Cue to the Role Centers of sales order processors. The Cue will show how many open sales invoices that they have. To accomplish this, Simon will create a Cue that extracts the number of open sales invoices from the Sales Header table. He will place the Cue in a part on the Order Processor Role Center page. He will also add an action that allows users to create a new sales invoice from a link on the Cue. The Cue will look similar to the previous figure.
Creating the Table Field for Cue Data
To calculate the number of open sales invoices, Simon creates a table that includes a FlowField that extracts data from the Sales Header table and calculates how many opens sales invoices exist. Because a table must have at least one data field and a FlowField is based on a calculation and not considered an actual data field, Simon adds a dummy primary key field that does not yield any data. For more information about FlowFields, see FlowFields Overview.
To create a table that includes fields for the Cue data
-
In the Classic Client, on the Tools menu, click Object Designer.
-
Click Table, and then click New.
-
In the first empty row, in the Field Name, type Primary Key and set the Data type to Code.
-
In the next empty row, in the Field Name, type Sales Invoices - Open and set the Data type to Integer.
This defines the Cue data field.
To define a filter on the cue data field
-
Click the Sales Invoices - Open field row, and then on the View menu, click Properties.
-
In the Properties window, set the FieldClass property to FlowField.
-
In the CalcFormula property, click the AssistEdit button to open the Calculation Formula window.
-
In the Calculation Formula window, set the Method field to Count and the Table field to Sales Header.
-
In the Table Filter field, click the AssistEdit button to open the Table Filter window.
-
In the first line of the Table Filter window, click the AssistEdit button.
-
In the Sales Header - Field List window, select Document Type, and then click OK to return to the Table Filter window.
-
In the Document Type row, set the Type column to FILTER and type Invoice in the Value column. This filters the Sales Header table on sales invoices.
-
On the next empty row, click the AssistEdit button.
-
In the Sales Header - Field List window, select Status, and then click OK to return to the Table Filter window
-
In the Status row, set the Type column to FILTER and type Open in the Value column. This filters the Sales Header table on open sales invoices.
The Table Filters window will look similar to the following figure:
-
Click OK until you return to the Properties window, and then close the Properties window to return to Table Designer.
To save the table
-
On the File menu, click Save.
-
In the ID field, type a number that will serve as a unique table identifier.
Note There are restrictions about which numbers you can use. Contact your Microsoft Certified Partner for information.
-
In the Name field, type Sales Invoice Cue.
-
Select the Compiled check box.
-
Click OK.
To set the table primary key and save the table
-
In Table Designer, select an empty row, and then on the View menu, click Keys.
-
In the Keys window, select the first line, and then in the Key column, select the AssistEdit button.
-
In the Field List window, select the first row, and then click the AssistEdit button.
-
Select Primary Key field, and then click OK until you return to the Keys window.
-
Close the Keys window to return to Table Designer.
-
On the File menu, click Save.
Creating a Cue on a Card Page for the Role Center
To display the Sales Invoice Cue on the Role Center, Simon creates a card part page type that has a CueGroup control that includes the Sales Invoices - Open field of the Sales Invoice Cue table. Simon also needs to initialize the data field on the Cue with a record, so he adds code to the OnOpenPage trigger of the card part page type.
To create the card part page for the Sales Invoice Cue
-
In the Classic client, on the Tools menu, click Object Designer.
-
In Object Designer, click Page, and then click New. The New Page dialog box opens.
-
In the Table text box, click the AssistButton to open the Table List window.
-
Select the Sales Invoice Cue table that you created in the previous procedure, and then click OK to return to the page wizard,
-
Click Create blank page, and then click OK.
The new page appears in Page Designer.
-
In the Caption field of the first row, which has the type Container and the subtype ContentArea, type SalesInvoiceContainer.
-
Select a blank row, and then on the View menu, click Properties.
-
Locate the PageType property, and then set the Value field to CardPart.
-
Close the Properties window to return to Page Designer.
To add the Sales Invoice Cue on the card part page
-
In the row after the ContentArea row, set Type to Group and set SubType to CueGroup. In the Caption column, type Sales Invoices.
The Caption value defines the heading for the Cue that appears on the Role Center.
-
On the next row, set the Type column to Field. In the Caption column, type Open. The Caption value defines the text that appears below the Cue.
-
With the row selected, on the View menu, click Field Menu.
The Field Menu window opens and displays the list of available fields from the Sales Invoice Cue table.
-
Select Sales Invoices - Open field, and then click OK.
Page Designer should look similar to the following figure:
-
To create a link from the Cue to the Sales Invoice List page for displaying the open invoices, select the Sales Invoices - Open field row, and then on the View menu, click Properties.
-
In the Properties window, set the DrillDownFormID property to Sales Invoice List.
-
Close the Properties window.
-
To initialize the cue with a record when the page opens, you must add code to the page's OnOpenPage trigger. In Page Designer, select an empty row, and then on the View menu, click C/AL code.
-
In the C/AL Editor, type the following code in the OnOpenPage trigger:
Copy Code RESET; IF NOT GET THEN BEGIN INIT; INSERT; END;
-
Close the C/AL Editor.
To save the sales invoice Cue card part
-
On the File menu, click Save.
-
In the ID field, type a number that will serve as a unique page identifier.
Note There are restrictions about which numbers you can use. Contact your Microsoft Certified Partner for information.
-
In the Name field, type Sales Invoice Cue.
-
Select the Compiled check box.
-
Click OK.
-
To run the page, in Page Designer, select the page, and then click Run.
-
The RoleTailored client opens and displays the new page.
Adding an Action to the Cue
Simon wants to add a link on the Cue that allows the user to create a new sales invoice. To accomplish this, he creates an action on the CueGroup control that targets the Sales Invoice page.
To add actions to the sales order queue page
-
In Page Designer for Sales Invoice Cue page, select the Sales Invoices CueGroup row.
-
On the View menu, click Actions.
-
In the first row of Action Designer, in the Caption column, type New Sales Invoice and set the Type column to Action.
-
With the first row selected, on the View menu, click Properties.
-
In the Properties window, do the following:
-
Set the RunFormMode property to Create.
-
Set the RunObject property to Page Sales Invoice
-
-
Close the Properties window, and then close Action Designer.
-
Save the page.
Adding the Cue Card Part Page on the Role Center Page
To display the Sales Invoice Cue on the Role Center, Simon must add the Sales Invoice Cue card part page to the Role Center page for sales order processors. To do this, he adds a part to the Order Processor Role Center page that targets the new Sales Invoice Cue card part page.
To add the Sales Invoice Cue to the Role Center page
-
In Object Designer, click Page to display the list of pages.
-
Locate page 9006, Order Processor Role Center, and then click Design.
-
In Page Designer, locate the Group control in which you want to include the Sales Invoice Cue page.
-
To insert a new row, right-click a row below the Group control, and then click New.
-
In the new row, set the Type column to Part.
-
On the View menu, click Properties.
-
Set the PartType property to Page.
-
In the PagePartID property, click the AssistButton button in the value field.
The Page List window opens.
-
Click the Sales Invoice Cue page and then click OK.
The Sales Invoice Cue page is the card part page that you created earlier in this walkthrough. For more information, see Creating a Cue on a Card Page for the Role Center.
-
Save the page.
-
Run the page.
See Also
© 2010 Microsoft Corporation. All rights reserved.