how to show choice with different name based on condition.

omsa1
Kilo Guru

Hi All,

I need help to rename the choices just for normal change, i have a field with Yes or No choices. if the ticket is normal change then i need to show yes choice as Yes - automatically. How can i do this?

 

 

1 ACCEPTED SOLUTION

omsa1
Kilo Guru

Hi asifnoor,

Thanks for the suggestions. Here is my script and its working as expected.  

if (Type == 'normal'){
g_form.clearOptions('u_alerts');
g_form.addOption('u_alerts','Yes','Yes - Automatically');

View solution in original post

8 REPLIES 8

AbhishekGardade
Giga Sage

Hello Osma

You can write onChange Client script to achieve the requirement.

please provide a screenshot what exactly you want to so I can help you directly with scripting.

Thanks,

Abhishek Gardade

Thank you,
Abhishek Gardade

Hi Abhishek,

i have type and alerts fields in  change_request table . when type is normal , the choice for alert should show Yes-Automatically and No , for others like standard change should show choices Yes and No as below. 

 

 

find_real_file.png

Hello Osma,

 

1. Create a new client script with below configuration on the table which these fields are available:

find_real_file.png

2. Check below script:

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var type =g_form.getValue('u_type'); // replace u_type with your Type name
if(type == 'normal'){ 
           g_form.setValue('u_alerts','yes'); // replace u_type with your Type name
}
else{
           g_form.setValue('u_alerts','no');
}
}

Please mark answer correct if you find it as helpful

Thanks,

Abhishek Gardade 

Thank you,
Abhishek Gardade

You can have a onChange Client script on field "Type"

Below script

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

var checkType = g_form.getValue('type');

if(checkType == 'normal') //Normal change type
{
alert("yes");
g_form.setValue("u_alert",'Yes'); // set alert field to yes
}
else
{
alert("Np");
g_form.setValue("u_alert",'No');

}

 

Regards
Harish