Set Variable Label in Service Portal

Steven Parker
Giga Sage

Has anyone figured out how to set a variable Label in the Service Portal?

Mark's (ServiceNowGuru) solution doesn't work for the Service Portal and g_form.setLabelOf doesn't work for the Service Catalog.


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven
4 REPLIES 4

Rohith Sabbinen
Mega Expert

Hi Steven,



Please try below threads, you can try to modify as per your requirements.



Change the variable's label dynamically


How do I modify the Help Label of Form Fields With Client Scripts?



Hope these help you.



Thanks,


Rohith.


Rohith,



I've tried those things, but they don't work in the Service Portal.



Please mark this response as correct and/or helpful if it assisted you with your question.
Steven

Steven Parker
Giga Sage

Anybody else have any suggestions that work in the Service Portal?



Actually this solved it...for both the ITIL Service Catalog and the Service Portal:


find_real_file.png



Here is the UI Script function:


find_real_file.png



Please mark this response as correct and/or helpful if it assisted you with your question.
Steven

dmahalwal
Kilo Contributor

For Service Catalog you can use:

var field = 'requested_for'; // requested_for is the database name for the variable
var labelElement = $('label_' + g_form.getControl(field).id).select('label')[0];
labelElement.innerHTML = 'Requested By'; // Requested By is the label name.

For Service Portal setLabelOf works fine.