Mousover Help Text in Record producer's Multiple Choice different options

ronro2
Tera Contributor

Hello guys!

This regards a Record Producer. I want that when you point with the mouse over one of the Multiple Choice options, that a specific help message is displayed for each option you hover over.

How do I achieve this? Should I create an onChange Client Script? The Multiple Choice variable is named 'errand_type'. Question Choice 'customer_payment' should have help text: "Choose this type if you have questions/problems regarding a payment with associated invoice and verification or any associated file management. We always prioritize payment matters before others, i.e. it is important that you use this type correctly. "

Question Choice 'customer_no_payment' should have the message "Choose this type if you have questions/problems regarding the handling of an invoice and verification or any associated file handling, but it does not concern payments."


I have this Client Script, which doesn't work: 

function onChange(control, oldValue, newValue, isLoading) {
    // Kontrollera om det är rätt variabel och rätt record producer
    if (control == 'errand_type' && g_form.getTableName() == 'x_vgll_rail_ticket') {
        // Hämta det nya värdet (valt alternativ)
        var selectedOption = g_form.getValue('errand_type');

        // Ange hjälptext baserat på det valda alternativet
        var helpMessage = "";
        switch (selectedOption) {
            case 'customer_payment':
                helpMessage = "Välj denna typ om du har frågor/problem kring en betalning med tillhörande faktura och verifikation eller eventuell tillhörande filhantering. Vi prioriterar alltid betalningsärenden före andra, dvs det är viktigt att du använder denna typ rätt.";
                break;
            case 'customer_no_payment':
                helpMessage = "Välj denna typ om du har frågor/problem kring hantering av en faktura och verifikation eller eventuell tillhörande filhantering, men den berör inte betalningar.";
                break;
            // Lägg till ytterligare alternativ här vid behov
        }

        // Visa hjälptexten
        g_form.showFieldMsg('errand_type', helpMessage, 'info');
    }
}

How will it know which form this applies to? There are several Record Producers based on the same table.

1 ACCEPTED SOLUTION

Amit Verma
Kilo Patron
Kilo Patron

Hi @ronro2 

 

Please use the below On-Change Client Script :

 

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }

   //Type appropriate comment here, and begin script below
	var selectedOption = g_form.getValue('errand_type');
	var helpMessage = "";
    switch (selectedOption) {
		case 'customer_payment':
                helpMessage = "Välj denna typ om du har frågor/problem kring en betalning med tillhörande faktura och verifikation eller eventuell tillhörande filhantering. Vi prioriterar alltid betalningsärenden före andra, dvs det är viktigt att du använder denna typ rätt.";
                break;
            case 'customer_no_payment':
                helpMessage = "Välj denna typ om du har frågor/problem kring hantering av en faktura och verifikation eller eventuell tillhörande filhantering, men den berör inte betalningar.";
                break;
            // Lägg till ytterligare alternativ här vid behov
        }

        // Visa hjälptexten
        g_form.showFieldMsg('errand_type', helpMessage, 'info');
   
}

 

AmitVerma_0-1705488769473.png

 

AmitVerma_1-1705488791671.png

 

Thanks & Regards

Amit Verma


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

View solution in original post

4 REPLIES 4

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @ronro2 

 

Check this

 

https://www.servicenow.com/community/developer-forum/change-help-text-based-on-multiple-choice-selec...

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Amit Verma
Kilo Patron
Kilo Patron

Hi @ronro2 

 

Please use the below On-Change Client Script :

 

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }

   //Type appropriate comment here, and begin script below
	var selectedOption = g_form.getValue('errand_type');
	var helpMessage = "";
    switch (selectedOption) {
		case 'customer_payment':
                helpMessage = "Välj denna typ om du har frågor/problem kring en betalning med tillhörande faktura och verifikation eller eventuell tillhörande filhantering. Vi prioriterar alltid betalningsärenden före andra, dvs det är viktigt att du använder denna typ rätt.";
                break;
            case 'customer_no_payment':
                helpMessage = "Välj denna typ om du har frågor/problem kring hantering av en faktura och verifikation eller eventuell tillhörande filhantering, men den berör inte betalningar.";
                break;
            // Lägg till ytterligare alternativ här vid behov
        }

        // Visa hjälptexten
        g_form.showFieldMsg('errand_type', helpMessage, 'info');
   
}

 

AmitVerma_0-1705488769473.png

 

AmitVerma_1-1705488791671.png

 

Thanks & Regards

Amit Verma


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

It didn't work as a mousover popup solution, however it worked really good as a solution for when choosing either of the options.

I am thankful! 🙂

Hi @ronro2 

 

You're welcome 😊

 

Thanks & Regards

Amit Verma


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