› Dynamics NAV › Procedure to create a custom Cue based on a query and a normal field in Dynamics NAV

Procedure to create a custom Cue based on a query and a normal field in Dynamics NAV

 Tina Menezes   Leave a comment

Introduction:

To show visual representation of aggregated data in Microsoft Dynamics NAV client, tiles are created in NAV which are called Cues. Cues are more user-friendly. It helps the user to get quick details of aggregated data like the total number of open sales orders, total number of customers with a particular status, etc.

Pre-Requisite:

Microsoft Dynamics NAV

Purpose:

In this article, I am going to demonstrate the procedure to create a custom Cue based on a query in Dynamics NAV. The scenario which I am going to elaborate is the numbers of contracts which is a custom entity repossessed in the current month.

Procedure:

  1. I have created a field ‘Status’ in my custom table ‘Contracts’ which is an option field which has the following OptionString ‘Created,Active,Terminated,Ended,Repossessed,Switched’. Now I am creating a cue to find the total number of contracts repossessed in the current month that means the total number of contracts for which status has been changed to ‘Repossessed’ in the current month.
  2. I have created two fields in ‘Contracts’ table viz. ‘Repossessed month’ and ‘Repossessed Year’ which will get populated with the Month name and the Year when the Contract status has been changed to ‘Repossessed’ respectively.
  3. The next step is to create a query. I have created a query ‘CF_RepossessedMonthQuery’ which will give the count of the total number of contracts repossessed in the current month.

    The result of the query is as follows:

  4. Now create a field in a new table which will store the count of the number of repossessed contracts in the current month.
    For this, I have created a new field in a table ‘RepossessedContractsMonth’ of DataType ‘Integer’ 
  5. Navigate to C/AL globals and create two new functions as below:  a. ‘ContractsRepossessedThisMonth’ with Return Value Name ‘CountContracts’ and ReturnType ‘Integer’ and the following local variables.

    Navigate to properties and set the local property of this function to ‘No’. Go to C/AL code and add the following code for this function:

    ‘DrillDownContractsRepossessedThisMonth’ with the following local variables: 

    Navigate to properties and set the local property of this function to ‘No’. Go to C/AL code and add the following code for this function:

    ‘DrillDownContractsRepossessedThisMonth’ is created so that on clicking the cue the respective records open in a list.

  6. The next page is to add the field created in step 4.
    Create a new group in a page with subtype ‘CueGroup’

  7. Go to C/AL code and in OnOpenPage() add the following code:

  8. In OnAfterGetRecord() add the following code:

    Assign the function created in step 5.a to the field added in the page ‘RepossessedContractsMonth’.

    In OnDrillDown() of RepossessedContractsMonth add the following code which will call the function created in step 5.b.

  9. Save the changes and run the page created in step 6. The output looks like below:
    On clicking the ‘Contracts Repossessed this Month’ Cue the 2 respective contracts are displayed whose status has been changed to ‘Repossessed’ in the current month.

    You can add these cues to any standard role center page like Business Manager Role Center, Sales Manager Role Center, etc.  so that the cues are visible when the user opens the NAV client.

Conclusion:

Using the above procedure, custom cues can be created in Dynamics NAV which will be displayed.
 


Liked it? Share it.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.