Important: This article was updated in a new blogpost. I suggest you read the new version of it here.
A big issue since the release of NAV 2009 is the 'lack' of colors. There was no possibility whatsoever regarding "coloring your fields on pages". Now, since NAV 2009 Service Pack 1, Microsoft introduces "Data Emphasis" as an enhancement. Let's try to find out what this is about and if it's really an enhancement (there is still no manual for this … so I'll have to do this on my own … (I'm just mentioning this to earn a little bit more credit … (… i'm going to shut up now … (…the word you're lookig for is … again … anywaaayyyy...)))).
I will take page 21 (Customer Card) and page 22 (Customer List) as pages to experiment with.
If we open the properties of the "No."-field of page 21, we notice these new properties :
The Style-property can have 5 values:
While the StyleExpr-property can contain either a variable (of the data type "boolean") or the strings "TRUE" or "FALSE".
Let's take it easy
Let's configure the "No."-field of Customer Card page like this:
If I run this page (remember that you can use the "run"-button in SP1), nothing really exciting is going on…
No colors, no emphasis whatsoever. Don't panic. Notice that you're in "view"-mode. Apparently, there is a difference for data emphasis in the different modes of a page. When you go in edit mode (you can do this by hitting CTRL+N (create new record) and scrolling down (by hitting CTRL+PgDn)) , you see that there IS a certain "emphasis", namely the value of the "No."-field is red:
That was simple, wasn't it?
Now, I tested with "Attention", but what with the other Option Values? Well, here's the list:
What about using these in a list?
When using these properties in a list, you'll notice there is no difference between view and edit mode. So, I just edited my list and changed the properties for the fields "No.", "Name", "Location Code", "Contact" with the result being a real "color-book":
Sorry dude, I only use conditional coloring. How do I do that?
Official statement of Microsoft: this is a no-go! (WHAT?? - Then there is no "bleeping" (remember the X-Files?) use for it, is there?). Now, hold your horses. I'm reading it as "this is not possible RIGHT NOW". Although .. What's that StyleExpr-property used for then?? Let me try to find out.
The property StyleExpr can hold a variable of the type "boolean". So let's just try to work with a variable and put it in the property. I created a variable blColorIt and set it TRUE when the "Location Code" of the customer was "YELLOW". Simple, isn't it. I put my code OnAfterGetRecord (seems most obvious for me)
blColorIt := ("Location Code" = 'YELLOW');
Unfortunately, it's indeed a no-go. All compiles well, but I get this error when running the page:
I've initialized my variable on every possible trigger I could find in my page, without succes. So, I'm guessing it's an internal issue … a feature that is not supported yet. If anyone succeeded in getting this to work … please don't hesitate to comment on this post … .
For me, coloring fields without conditions doesn't make much sense (may be for identifying mandatory fields … but that's it (imho)). But the fact that things are in place to make it conditional gives me hope that in the next release … it WILL be conditional after all.
Also keep in mind: I'm testing on a Technical Preview, not an official release … so the hope is still there that everything will be in place on the final release of NAV 2009 Service Pack 1 :-).
Wito, you're absolutely right ... I changed it in a new blogpost here:dynamicsuser.net/.../data-emphasis-in-microsoft-dynamics-nav-2009-sp1-ctp2-update.aspx
Thanks, man! What a turnaround :-)
thanks for the explenation of this.
did you try to use the property IncludeInDataset on the variable blColorIt?
If not try to set this property to True and try again.