How to add tooltip on form section

Ap_1
Tera Contributor

We have one requirement to add tooltip on a form section with both English and French (screen shot attached).

 

Can anyone please suggest how to achieve this.

2 REPLIES 2

Abbas_5
Tera Sage
Tera Sage

Hello @Ap_1,

Please refer to the below link:
https://www.servicenow.com/community/developer-forum/tooltip-for-form-section/m-p/2401240

 

Mark my correct and helpful, if it is helpful and please hit the thumbs-up button to mark it as the correct solution.
Thanks & Regards,
Abbas Shaik

Its_Azar
Tera Guru

Hi @Ap_1 

 

I guess we can do this, firstly, create a new UI Policy under "System UI > UI Policies". Specify the relevant table for your form section and define the conditions under which the tooltip should appear. 

Next, create a Client Script of type "OnLoad" to dynamically set the tooltip text on the ur language preference. You can  conditionally set the tooltip text accordingly in both English and French.

Apply the UI Policy to the form sections by specifying the condition in the UI Policy configuration. 

This is the ex of client script below

 

(function() {
    var tooltipText = '';
    var userLanguage = g_lang; // Assuming g_lang contains the user's language preference

    if (userLanguage === 'fr') {
        tooltipText = 'Texte de l\'info-bulle en français';
    } else {
        tooltipText = 'Tooltip text in English';
    }

    g_form.setSectionDisplay('section_name', true, tooltipText); // Replace 'section_name' with your form section name
})();

 

If this helps kindly accept the answer thanks much.

Regards

Azar

☑️ If this helped, please mark it as Helpful or Accept Solution so others can find the answer too.




Kind Regards,

Mohamed Azarudeen Z

Developer @ KPMG

 Microsoft MVP (AI Services), India