web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

need to change font color based on some condition

(0) ShareShare
ReportReport
Posted on by 2,102

Hi,

I need to highlight the general journal lines field[shortcut dimension 1 code] based on some filter and I tried to write code for that but it didn't work as expected.

you can see in the below screen print I tried this two-way, one is to create a custom action and write the logic in that, and the second is using the standard trigger of Microsoft.

pastedimage1671448132381v5.png

pastedimage1671448153662v6.png

pastedimage1671448178096v7.png

pastedimage1671448193453v8.png

Note: here GetCorporateId() is my custom procedure and it is working as expected.

This above code didn't work as expected, it has been populated with red color in all the lines, But what I need is when the Corporate id is 14 then I need to highlight the 'shortcut dimension 1 field' with red color otherwise none.

Can anyone tell us what is the missing part in this code?

I have the same question (0)
  • Suggested answer
    Nitin Verma Profile Picture
    21,708 Moderator on at

    Hi,

    Please always put your code in text format not in image.

    put your code on OnAfterGetCurrRecord too.

    Thanks.

  • Suggested answer
    pankaj.k Profile Picture
    994 on at

    Hi Inkey,

    everything is fine but you need to do some more customization for this Please check below steps.

    Step1: Create one new Text filed For Storing the data Standard or Unfavorable.

    Step2: Assign StyleEXpr to your NewField. (StyleExpr = NewField;)

    Add my suggestion  with your customization that will work.

  • Suggested answer
    DAnny3211 Profile Picture
    11,397 on at

    CIao

    use the second and enter onmodify on the page

    CurrPage.UPDATE(FALSE);

    if that doesn't work, check the getcorporateid function again, I don't want there to be anything wrong with it

    DAniele

  • Inkey Solutions Profile Picture
    2,102 on at

    Hi Daniele Incalza,

    Your answer is works for me but when I try to insert new other lines it will give me the below error.

    pastedimage1671455583926v1.png

    Thank you.

  • Suggested answer
    pankaj.k Profile Picture
    994 on at

    Hi Inkey

    Check with my answer 

    7356.Capture.PNG

    New Field Value must be Standard or Unfavorable.

  • Suggested answer
    YUN ZHU Profile Picture
    95,763 Super User 2025 Season 2 on at

    Hi, hope the following helps.

    Change field color based on field value in Dynamics 365 Business Central

    https://yzhums.com/1599/

    Thanks.

    ZHU

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,116

#2
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 764 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 635 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans