- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2017 08:21 AM
Hi everybody,
I have to show a message in my catalog items form. This message has to be in html format because is a bit log and the customer wants to see Underline and break-line.
I created the following catalog client script, but it doesn't work.
function onChange(control, oldValue, newValue, isLoading){
var choiceValue = g_form.getValue('var_1');
var knowledgeMessage = "<u>Service Availability Window<u>: h24 <br>
<u>Maintanance Window<u>: once every three months and Sunday redslot <br>
<u>Backup Weekly<u>: retention 30 days <br>
Backup Monthly: retention 12 months <br>
";
if (choiceValueNeededFor != 'none') {
if (choiceValueNeededFor == 'application') {
g_form.showFieldMsg('var_1', knowledgeMessage,'info');
}
}
}
Please, could you help me? Thanks a lot.
Mara Bin
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2017 11:27 PM
Hi Mara,
You can achieve this requirement by using a new Variable of type Macro. I have answered similar question earlier, please refer that here: Annotations without a variable field on Record Producer .
Again to use the HTML text, such as <a> tag or <br> tag, you need to change the system property (change it to false) 'glide.ui.escape_text' for this. Note: Please do remember that it will change globally. Please refer section 3 here: http://wiki.servicenow.com/index.php?title=High_Security_Settings
I hope this helps. Please mark correct/helpful based on impact

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2017 10:53 AM
I've done this kind of thing by creating a Macro [sys_ui_macro] and adding the macro as a variable in the catalog item. But I believe the Macro variable type doesn't work in Service Portal - something to consider if you choose this route.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2017 10:52 PM
Thank you Nia for your helping me.
First of all I will try to create a macro and I will check in the Portal if it works well.
Tahnks again
Mara

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2017 11:41 AM
Hi Mara,
You can include HTML text in your catalog item description.
Please see example below for HTML source code.
<p><img class="img-responsive" src="/sc_infrastructure_resource.pngx" alt="" align="baseline" border="0" hspace="0" vspace="0" /></p>
<p> </p>
<div>Request for professional services support by an infrastructure administrator. Request is for labor only support by infrastructure administrators including System Administrators, Database Administrators, Storage Administrators, or Data Center technicians.</div>
<div> </div>
<div><span style="color: #ff0000;">****** NOTE ******</span><br /><br />Project/Functional teams are expected to fund for Application Run work requiring greater than 10 hours of AHS resources per year per application. When opening requests beyond the initial 10 hours, please provide Project WBS Code or Cost Center Charge Code. The charge rate will be $100 per hour.</div>
<p> </p>
<p> </p>
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2017 11:03 PM
Hi Sachin,
Thank you for your help, but my issue is a bit different. i put my form below so you can see: for any differnt choice in the select box, i have to put a message in a correct format:
Example: if I select "application", at the bottom at the page I have to see this message, with the correct break line and not all in one row:
Service Availability Window: h24
Maintanance Window: once every three months and Sunday redslot
Backup Weekly: retention 30 days
Backup Monthly: retention 12 months
If I use my script and the method g_form.showFieldMsg("Service...."), I obtain this result that is not correct:
I hope this help you to undestand which is my issue.
And thanks again
Best regards
Mara