How to show field message info for each of select box in a sub category .

Sadashiva Das1
Tera Contributor

How to show field message info for each of select box in a sub category .We have 40 select box .

if sub category = A then message "test a"

B = Message is "test b"

c = "Test  c"

like 40 selection is there .

 

Regards, Please suggest 

12 REPLIES 12

Sagar Pagar
Tera Patron

Hello Sadashiva,

 

You could create onchange Catalog Client script for catalog item. where variable is your sub category.

in script write the script.

 

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

    var messgae  =  "This is a messgae " + newValue;

    g_form.showFieldMsg('location', messgae, 'info');

}

 

find_real_file.png

Thanks,

Sagar Pagar

The world works with ServiceNow

Subhojit Das
Kilo Guru

Hi Sadashiva,

Please copy and paste the below code in your client script, you will get the desired output.

Type: onChange

Field name: <name of the choice field>

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
 //Replace u_custom_choice with your choice field name
   g_form.showFieldMsg('u_custom_choice','Test  '+newValue,'info');
   
}

If I was able to resolve your issue then please mark as Correct and Helpful.

Regards,

Subhojit

sriram35
Kilo Guru

Hi,

 

You need to write onChange client script for this.

Please use below script it will help you

find_real_file.png

You will get below results

1. If you select CPU in subcategory field

find_real_file.png

2. If you select DB2 in subcategory field

find_real_file.png

3. If you select the IP address in subcategory field

find_real_file.png

4. If you select mouse in subcategory field

find_real_file.png

5. If you select Antivirus in the subcategory field it will not show any info message why because we have not mentioned it in the script.

find_real_file.png

 

Hope this helps!

If you have any more questions, please let me know.

If I have answered your question, please mark my response as correct and helpful.

Thanks,

Sriram

Hi Sadashiva,

 

If I have answered your question, please mark my response as correct and helpful. 

so that this thread can be closed and others can be benefited by this.

 

Thanks

sriram