Change the color of mandatory icon in the serviceportal

kristianhaahr
Kilo Contributor

Hi, where can i change the color for the mandatory icon?

find_real_file.png

1 ACCEPTED SOLUTION

Forgot to include the screenshot of the portal record:



setting_css.png


View solution in original post

8 REPLIES 8

Chuck Tomasi
Tera Patron

Hi Kristian,



It's not currently a Service Portal option you can configure - as far as I know.



What is the business requirement driving this? Red is a pretty standard color for mandatory fields and stands out well. Is this a curiosity question or do you have a business requirement driving this?



If you really NEED to, you can likely write yourself a client script or modify the CSS. I don't have details on this, but assume there's a class/id that is setting this.


I know there is no global property for this in the service portal and i have tried to find the css code to change ot, but with no luck.



Its not business requiement, but i try to keep the design of the service portal to few colors and red is not one of them


As you see, i have changed the color for the "Requied information" fields from red to blue. just because i prefere that.


If you use the developer console in your browser, you may be able to do a little detective work and find out what CSS triggers that little red asterisk and then override in your portal theme/css.


ChrisBurks
Mega Sage

Hi Kristian,



Chuck has a very good point. It's a very high percentage that red is associated with mandatory fields.



However, if this is really what you need, there are several ways this can be done depending upon what the exact requirement is. For instance if this color change is across the board for all and any mandatory field on Service Catalog items then Chuck again is correct in modifying the CSS. That red asterisk is a font awesome font and the way it put there is via a class called "fa fa-asterisk". Also when the field isn't filled in the class "mandatory" is added to the containing element.


Thus you have these classes applied to that containing field: "fa fa-asterisk mandatory".


Use this on the portal record, in the CSS Variables field to change the color.


I.e.


.fa.fa-asterisk.mandatory {


          color: #00ff00; /* green */


}



Of course you can change the color to your needs.


You'll also need to make it's counter part for when the field gets populated indicating that the mandatory requirement has been fulfilled. Once the field is populated the system adds another class "mandatory-filled" to the containing element. This gives you "fa fa-asterisk mandatory mandatory-filled" as the classes applied to the element. So just add another CSS style to handle that.



.fa.fa-asterisk.mandatory.mandatory-filled {


              color: #979797; /*gray*/


}



You could also make this use a Sass variable to make it more flexible to use but this should do it.



here it is in action:


css_mandatory