Change style multi line text

emanuelesignori
Kilo Contributor

Hi all,

i have a multi line text variable in a catalog item on service portal.

How can i change the style of this variable on service portal? For example, i would want to change background color, color text, bold, ecc.

The name of the variable is var_ssmart_infoautista

 

Thanks in advantage.

Regards,

Emanuele Signorin

4 REPLIES 4

HugoFirst
Kilo Sage

Why not make the variable of type HTML?   You'll get the editor that supports the kind of formatting that you are asking about.


find_real_file.png


Thank you for your response Steve.


Can i hide the bar in yellow in service portal?



find_real_file.png


How can i set default formatting value for this variable?


I don't have the definitive answer for you.   But there is some advice at this page:


Variable Types - ServiceNow Wiki



Note that the edit bar disappears if the variable is readonly.


I'm not sure that is satisfactory for you.   But it's the only advice I had at the moment.


Does anyone else know about this?




EDIT:



Here's a link to a more recent document with more information about configuring the edit menu for HTML fields.


Note that it doesn't say how to remove it completely.   But you do have some control over what displays.


It's also good to know which type of editor you're using, as the instructions vary depending upon the editor in use.


HTML field type


Aditya Telideva
ServiceNow Employee
ServiceNow Employee

Use the below code:



function onChange(control, oldValue, newValue, isLoading) {


  var cTypeLabel = $('label.incident.contact_type');


  var cTypeField = $('incident.contact_type');



if (newValue == 'Self Service') {


  cTypeLabel.setStyle({backgroundColor: "red"});


  cTypeField.setStyle({color: "red"});


  }


  else {


  cTypeLabel.setStyle({backgroundColor: ""});


  cTypeField.setStyle({color: ""});


  }



}



Thanks,


Aditya Telidevara