Service Catalog Item rich text label populated with values obtained through Client Script

litchick10
Tera Guru

We have a catch all catalog item and we are trying to get users to use the correct catalog item instead of using the catch all. We currently have rich text label field that displays a list of catalog items that could be used based on category selected. We want to automatically populate the info for each category with a client script.  I don't need help with the script but I cannot seem to figure out how to change the html contents of the rich text label. Do I need to use another field type or is their a way to set the value of the html from the client script. 

 find_real_file.png

7 REPLIES 7

Hi,

Initial assessment would be that you'd have different UI Pages for the different results you want to show. Then, create multiple macro variables with the different UI Pages associated, and then use client script to setDisplay, etc. on those.

A bit clunky, I know, but that's how you can at least do it, for now.

You could possibly review manipulating the DOM and the rich text label variable within client script, but you'd have to set the "Isolated script" checkbox (if not on client script form, add it) and set that to false. As I'm sure you know, DOM manip is not recommended though.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

setLabelOf doesn't seem to work with labels either

g_form.clearValue('guidance_message') ;

g_form.showFieldMsg('name','Dummy message','info') ;
g_form.setLabelOf('guidance_message', 'modified guidance message here');

 

The only way I've found to display a string of modified text is via showFieldMsg so far.....

Matt Small1
Tera Expert

I have found that g_form.setLabelOf works for the service portal intake of the request but not when using the client intake for the Rich Text Label Variable type. 

The alternative is to use the HTML variable type and use g_form.setValue('variable name', desc) along with g_form.setReadonly('variable name', true);