The CreatorCon Call for Content is officially open! Get started here.

How to manipulate a field with the options of a multiple choice field?

RenomarioC
Tera Contributor

I have a doubt to do this, in my cenario i need for example:

RenomarioC_0-1752712316735.png

If the option in field Movimentação is Garantia, the choice "Desenvolvimento" need to be invisible..
I was trying with g_form.removeOption(); but this don´t work for field like Multiple Choice.

any help is welcome, thank you so much!!


1 ACCEPTED SOLUTION

Hi @RenomarioC ,

 

you create the onChange client script on the multiple choice type variable

ChaitanyaILCR_0-1752758858423.png

 

it's the basic script (enhance it as per your requirement)

here when a user try to select value tset3 the client script clears it and shows the message

 

add you logic in the (if condition when a value can be selected and when it should not be)

ChaitanyaILCR_1-1752758894764.png

 

I don't know you exact requirement but you can enhance it with this idea

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

View solution in original post

9 REPLIES 9

Hi @RenomarioC ,

 

you create the onChange client script on the multiple choice type variable

ChaitanyaILCR_0-1752758858423.png

 

it's the basic script (enhance it as per your requirement)

here when a user try to select value tset3 the client script clears it and shows the message

 

add you logic in the (if condition when a value can be selected and when it should not be)

ChaitanyaILCR_1-1752758894764.png

 

I don't know you exact requirement but you can enhance it with this idea

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

Thank you so much for your help, i did and put my criteria and its work!

Di Zhang
Tera Guru

Please try 

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
    g_form.clearValue('request_type');
    g_form.setValue ('request_type', 'test2');  //you need to pass variable name and choice value
       
}

Sorry, It seems clearValue not working for multiple choice

Ankur Bawiskar
Tera Patron
Tera Patron

@RenomarioC 

Please inform customer to use select box variable as g_form.remove and addoption won't work for multiple choice

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