How to set the color of a variable

Gemma4
Mega Sage

Hi Everyone,

I have a requirement to change the color of a particular variable that is hidden on the portal and visible on the RITM. I made the variable visible on the portal and tried to see if I could achieve this on the portal- so I could make sure it works for RITM. I set the variable as htm and added the following 

<font size=4 color='red'><i>Test text for variable</i></font>

When I select try it, it does appear correctly but it is adding a formatting box below that I don't want. However when I go directly to the portal it is not displaying correctly at all. I've attached a few screenshots to explain better. I just need a way for a container or variable to appear in bold and red so the user can easily see it on RITM. I'm open to any ideas you have to achieve this as efficiently with the least code changes. 

thanks in advance for your help!

 

 

 
 
4 REPLIES 4

Community Alums
Not applicable

Hi @Gemma4 ,

 

Is that just a simple label text that you want to have the style? If so just create a Rich Text Label variable, from a Rich Text field, click Source Code and add this: "<p style="font-size: 14pt; font-weight: bold; color: red;">Your text</p>"

Riya Verma
Kilo Sage
Kilo Sage

HI There,

  1. Create a new Rich Text Label variable:

    • Navigate to the Service Catalog in ServiceNow.
    • Create a new catalog item or locate the existing one where you want to display the variable.
    • Add a new variable of type "Rich Text Label."
  2. Set the variable content using HTML:

    • Click on the variable you created to edit its properties.
    • In the variable settings, find the "Default Value" field and select the option to "Write HTML directly."
    • In the HTML editor, paste the following code to set the desired formatting:
<p style="font-size: 14pt; font-weight: bold; color: red;">Your text</p>
Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma

Thank you @Riya Verma really appreciate the feedback

Unfortunately I don't have an option to "Write HTML directly" 

@Gemma4 , please try changing the type of variable and then use the styling 

 
Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma