Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to add long label questions on form?

Tapish Sharma1
Kilo Sage

Hi Folks,

I have a requirement to include questions on form. The questions comprise of one- two short sentences. What is the best approach to follow ? Shall I increase the column label length? or is there any other approach to it. 

1 ACCEPTED SOLUTION

onLoad Client Script to change question text (fieldname: question_1) in UI. The current script only works in UI and not in Service Portal but I think something similar can be done. Since it's DOM manipulation, need to uncheck "isolate script".

Increasing length of the question field may cause performance problem in the instance.

function onLoad() {
    try {
        setLabelOfInServiceCatalog('question_1', '1. I have a requirement to include questions on form. The questions comprise of one- two short sentences. What is the best approach to follow ? Shall I increase the column label length? or is there any other approach to it. ');
    } catch (e) {
        alert(e.message);
    }
}

function setLabelOfInServiceCatalog(fieldName, value) {
    var fieldId = g_form.resolveNameMap(fieldName);
    var label = gel('label_' + fieldId);
    $j(label).text(value);
}

Execution result:

find_real_file.png

View solution in original post

10 REPLIES 10

onLoad Client Script to change question text (fieldname: question_1) in UI. The current script only works in UI and not in Service Portal but I think something similar can be done. Since it's DOM manipulation, need to uncheck "isolate script".

Increasing length of the question field may cause performance problem in the instance.

function onLoad() {
    try {
        setLabelOfInServiceCatalog('question_1', '1. I have a requirement to include questions on form. The questions comprise of one- two short sentences. What is the best approach to follow ? Shall I increase the column label length? or is there any other approach to it. ');
    } catch (e) {
        alert(e.message);
    }
}

function setLabelOfInServiceCatalog(fieldName, value) {
    var fieldId = g_form.resolveNameMap(fieldName);
    var label = gel('label_' + fieldId);
    $j(label).text(value);
}

Execution result:

find_real_file.png