If the short description contain infra keyword in the beginning then category should add a new choice “INFRA” and set it to the same.

Prasanna41
Kilo Contributor
  • If the short description contain infra keyword in the beginning then category should add a new choice “INFRA” and set it to the same.
2 REPLIES 2

Nikita Tajane
Kilo Expert

You can Write following onchange client script

 

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var sd = g_form.getValue('short_description');
if (sd == 'INFRA') {
var pos = sd.search('INFRA');
if (pos == 0) {
g_form.addOption('category', 'infra', 'Infra');
g_form.setValue('category', 'infra');
}
} else {
g_form.removeOption('category', 'infra', 'Infra');
}


//Type appropriate comment here, and begin script below

}

 

 

Please mark as correct or helpful,

regards,

Nikita Tajane

 

 

Astik Thombare2
Tera Contributor

Use the following onchange client script on short description field

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
g_form.removeOption('category','infra','INFRA');
g_form.setValue('category','');
return;
}
var SD = g_form.getValue('short_description');
var newSD = SD.includes('infra');
if(newSD == true){
g_form.addOption('category','infra','INFRA');
g_form.setValue('category','infra');


}

}