Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

How to set RITM details Labels as Bold?

Not applicable

The details are populating before insert business rule.
Can we make only labels from left side bold and populate?

 

Manikantahere_0-1751447497740.png

 

9 REPLIES 9

Not applicable

hi @Community Alums ,

try this 

copyVars();

function copyVars() {
    var wn = '';
    var varown = new GlideRecord('sc_item_option_mtom');
    varown.addQuery('request_item', current.sys_id);
    varown.orderBy('sc_item_option.order');
    varown.query();

    while (varown.next()) {
        var question = Packages.com.glideapp.questionset.Question.getQuestion(varown.sc_item_option.item_option_new);
        var label = question.getLabel();
        var displayValue = question.getDisplayValue();

        // Skip if label or value is empty / invalid
        if (!label || !displayValue || displayValue == '-- None --' || displayValue == 'false' || question.order <= -1) {
            continue;
        }

        // Skip specific labels
        if (label.startsWith("Person this request is for") || label.startsWith("Incident Details")) {
            continue;
        }

        // Append to the result
        wn += '\n<strong>' + label + ':</strong> ' + displayValue;
    }

    gs.log(wn);
    current.u_item_details = wn;
}

Not applicable

Manikantahere_0-1751451572144.png

 

getting like this?

 

@Community Alums 

Seems you missed the 1st response to your question which I shared.

If your field is String -> Then it won't work

Convert that field to HTML and then add the logic

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Community Alums 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Community Alums

It looks like you're currently using a String type field, which doesn't support rendering HTML formatting. To make the bold tags (<strong>) work as expected, you'll need to change the field type to HTML.

 

Once you've updated the field type, run your script again and the labels should render in bold correctly. Let us know how it goes after making these changes and testing it further!