If subcategory is email or antivirus then service field must be hidden

Shubham_verma
Tera Contributor

If subcategory is email or antivirus then service field must be hidden on incident form.How to achieve this using client script?

1 ACCEPTED SOLUTION

@Shubham_verma  write on change client script on subcategory field and use the below code snippet.

 

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (newValue === '') {
        return;
    }
    
    var subcategory = g_form.getValue('subcategory');
    
    if (subcategory == 'email' || subcategory == 'antivirus') {
        g_form.setDisplay('business_service', false);
    } else {
        g_form.setDisplay('business_service', true);
    }
}

 

 



View solution in original post

6 REPLIES 6

Sumanth16
Kilo Patron

Hi @Shubham_verma ,

 

Create on change client script and select field "subcategory" and add below script:

 

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var subcat = g_form.getValue('sub_category');//update your field name
if (subcat == "email") {//update email value
g_form.setDisplay('u_rate',false);  // update your service field name

}
}

 

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,

Sumanth Meda

function onChange(_control, _oldValue, newValue, isLoading, _isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
    var subcat = g_form.getValue('subcategory');//update your field name
if (subcat == "email") {//update email value
g_form.setDisplay('business_service',false);  // update your service field name

}}
   //Type appropriate comment here, and begin script below
   
}           
issue still persists!