Putting '?' icon next to the felid

MadhuDanalN
Tera Contributor

Hey guys I need a help with a customization in the SIR form. I have some fields in the form and the client want to put some hints and a interrogation icon next to the field "?". I managed to put the hint in the label configuration in the field but I can't put the icon next to him.

1 ACCEPTED SOLUTION

vignesh parthib
Tera Guru

Hi @MadhuDanalN 

You can try inject a DOM element dynamically .

But Direct DOM manipulation (document.querySelector etc.) is not officially supported or recommended in ServiceNow Client Scripts.

 

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) return;

// Remove existing icon
var existingIcon = document.querySelector('#impact-info-icon');
if (existingIcon) existingIcon.remove();

if (newValue == '2') { // Low
var icon = document.createElement('span');
icon.id = 'impact-info-icon';
icon.className = 'icon-help';
icon.style.marginLeft = '10px';
icon.style.cursor = 'pointer';
icon.title = 'Low impact: Issue affects one user or a minor function.'; // Tooltip text

var label = document.querySelector('label[for="impact"]');
if (label) label.appendChild(icon);
}
}

 

Thanks,
Vignesh
"If this solution resolves your issue, kindly mark it as correct."

View solution in original post

12 REPLIES 12

MadhuDanalN
Tera Contributor

Hi @Ankur Bawiskar , thank you for the reply.

For example, in the Impact field (High, Low, Medium, Critical), when the user selects a particular choice (e.g., Low), they should be able to click on a ? icon or similar to see the explanation message. based on the demand it will be visible to the user

@MadhuDanalN 

you can use onChange client script and show field message when they select the Impact choices.

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

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

@Ankur Bawiskar That works for displaying the message for particular choices. However, what I want is that when the user selects Low, they should not see the message immediately — the message should only appear when they click the “?” icon.

@MadhuDanalN 

You cannot change the hint dynamically.

so the only option is field message.

Thank you for marking my response as helpful.

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

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

@MadhuDanalN 

Thank you for marking my response as helpful.

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

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