The CreatorCon Call for Content is officially open! Get started here.

HTML Help text Service Portal

Brian Lancaster
Tera Sage

I have the following code to make it so that I could use HTML in the help text.   This is in an on load script that is in the catalog item client scripts.   How can I get this to work in the new Service Portal?

function onLoad() {

  //Type appropriate comment here, and begin script below

  $$("div.sc-help-text").each(function(item){  

  var textValue = item.innerText;  

  $(item).update(textValue);  

  });  

}

1 ACCEPTED SOLUTION

Hi Brian,



I checked this issue and found that the   problem was with the page load time so I added timeout function which will get execute after 1.5 seconds.


Please find below updated script :



function($timeout) {


  /* widget controller */


  var c = this;


  $timeout(function() {


  jQuery('p.help-block').each(function() {


  jQuery(this).html(jQuery(this).text());


  });


  }, 1500, false);



}


Screen Shot 2017-06-27 at 5.05.17 PM.png


View solution in original post

21 REPLIES 21

Hi Brian,



Which release version of ServiceNow that you are using?   If possible, Can you please try in your personal development instance and share URL of instance ?


Just review the below points:



You should have newly created widget where in client controller below script is present ?   and that widget has been added to your catalog item page (sc_cat_item)


  1. function() {  
  2.   /* widget controller */  
  3.   var c = this;  
  4.             jQuery('p[title="More information"]').each(function() {  
  5.                       jQuery(this).html(jQuery(this).text());  
  6.             });  
  7. }  

--


Variable:


Screen Shot 2017-06-27 at 4.16.04 AM.png



In Service Portal :



Screen Shot 2017-06-27 at 4.16.57 AM.png


We are on Helsinki Patch 9.   Below is my Personal dev instance.   I have created a Item called test under hardware category with the code in help text.


SP Loading page



Our help text title was changed to "Click Here for More information" so I updated the code as per below.



function() {


  /* widget controller */


  var c = this;


  jQuery('p[title="Click Here for More information"]').each(function() {


  jQuery(this).html(jQuery(this).text());


  });


}


Hi Brain,



Thanks for sharing.



I checked the issue, Can you please update your script with below :



jQuery('p.help-block').each(function() {


  jQuery(this).html(jQuery(this).text());


  })


}


Screen Shot 2017-06-27 at 12.15.52 PM.png


--



Screen Shot 2017-06-27 at 12.17.35 PM.png



Let me know if you face any issue.


This is still not working for me in my instance or my developers instance.