Hide Closed state on Cases

Rob Jennings
Tera Contributor

I am looking for a way to hide the Closed state on Cases, like the oob BR on the Incident form. Not as straight forward as I thought it would be. Relatively new to cases so any help is much appreciated.

1 ACCEPTED SOLUTION

Siva Jyothi M
Mega Sage

Hi @Rob Jennings,

 

You can hide with onload client script, or you can throw an alert like below. When a user selects closed state, the below code throws alert and sets the incident state to it's old state.

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }
  if (newValue == '3') {
        alert('Manually selecting "Closed" is not allowed. Kindly "Resolve" the ticket.');
        g_form.setValue('state', oldValue);
   }
}

Please mark this answer as correct and helpful if it solves your issue.

Regards,

Siva Jyothi M.

View solution in original post

4 REPLIES 4

Saurabh Gupta
Kilo Patron
Kilo Patron

Hi,
You can write a onLoad script with the line of code-

g_form.removeOption('state','3');//assuming closed state back-end value is 3.

 

 


Thanks and Regards,

Saurabh Gupta

Siva Jyothi M
Mega Sage

Hi @Rob Jennings,

 

You can hide with onload client script, or you can throw an alert like below. When a user selects closed state, the below code throws alert and sets the incident state to it's old state.

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }
  if (newValue == '3') {
        alert('Manually selecting "Closed" is not allowed. Kindly "Resolve" the ticket.');
        g_form.setValue('state', oldValue);
   }
}

Please mark this answer as correct and helpful if it solves your issue.

Regards,

Siva Jyothi M.

Thank you very much! That is an excellent solution

Glad the solution worked for you.