25 May’18

D365 Business CentralHow to change the font colour of a List page based on a condition in Dynamics NAV

Intoduction:

The requirement was such that, based on a condition certain lines should appear in Red.This can be done by using page control Style Property. The Style property has ten values that apply different formats to field text as below:

Value Format
Standard Standard
StandardAccent Blue
Strong Bold
StrongAccent Blue + Bold
Attention Red + Italic
AttentionAccent Blue + Italic
Favorable Bold + Green
Unfavorable Bold + Italic + Red
Ambiguous Yellow
Subordinate Grey

Pre-Requisites:

Microosft Dynamics NAV 2017

Steps:

1. Create a global variable i.e. on the View menu, choose C/AL Globals.

2. Define the variable, and then set the DataType to Boolean.

3. Open the Property of the variable then set the IncludeInDataSet to Yes. (I’ve use CFS_Repo as my boolean field).

4. Create a local function. (in my case UpdateStyle).

5. Now, code in the function. My requiremnt was such that if field  RepoInitiated is true then the line should should appear red. You can code as per tour requirement.

6. On the trigger OnAfterGetCurrRecord, call the function.

7. Now select the Field in the List page and click on Properties (Shift + F4)

8. Set the Style to Unfavorable and StyleExpr to CFS_Repo (the boolean field )

9. Repeat the step 8 for all fields present on the list page.

Written by

Chris D'Silva

Software Developer

Leave a Reply

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

Time limit is exhausted. Please reload the CAPTCHA.

Want to streamline your business processes?

  • This field is for validation purposes and should be left unchanged.

Recent Articles

  • “$ undefined error” conflict issue in Dynamics 365 v9.0

    18 June’ 2018

    Introduction: After upgrade of dynamics CRM 8.2 to 9.0 jQuery start breaking or you will receive $ undefined error. Th...

    Read more
  • Creating Custom Fields

    18 June’ 2018

    Introduction: This blog articles explains the ability to add custom fields is available in platform update 13 and later...

    Read more
  • Explore Business Central API through Postman using Basic Authentication

    14 June’ 2018

    Introduction: In this article, we will walk through steps on how to authenticate Business Central API using Basic Authe...

    Read more
  • Setup Positive Pay Export

    14 June’ 2018

    Introduction: What is Positive Pay Export and Why it’s used? Positive Pay Export is a file that is given to the ...

    Read more
  • Create Approval Flow with D365 conection

    12 June’ 2018

    Introduction: This blog explains how to Create Approval Flow using Microsoft Flows.  Use Case: When work order is upd...

    Read more