Delete UI action for Problem Table

Priyadharashini
Kilo Contributor

Hi,

I have created a 'Delete' UI Action for the Problem table by using 'Insert and Stay' option from the OOB Delete button which is in Global table. I have a condition that the Delete button should be visible only in the closed state and Resolution code should be "Risk Accepted" and the user should have the Role of "Problem manager".

Condition works fine but the button does not perform any action and remains in the same page. Please provide your suggestions to achieve this.

 

find_real_file.png

1 ACCEPTED SOLUTION

ChanakyaMekala
Kilo Guru

In the script, rather than using the already existed code, use normal delete statement.

 

Simple "current.deleteRecord()" would be enough. And if needed add necessary dialog boxes.

 

Below is an example for such:

 

function deleteClient(){
  if(confirm("Do you want to delete this record?")){
    gsftSubmit(null,g_form.getFormElement(),'deleteRecord');
  }else{
    alert("Record has not been deleted") ;
  }

}


if(typeof window == 'undefined'){
  myServerSideFunction();
}

 

function myServerSideFunction(){
  current.deleteRecord();
}

For this you should

1. Check Client check box. Then in the Onclick field you should mention client function. Here I have mentioned it as deleteClient() function.

2. Action name should be populated with appropriate name. Here I have mentioned it as deleteRecord.

Please mark Answer or Helpful if it had so.

View solution in original post

5 REPLIES 5

asifnoor
Kilo Patron

Did you write the code inside a confirmandeletefromForm function? If yes, can you share the code of that to debug.

Devyani_6
Mega Guru

Hi,

Have a look on below threads, this will helps you.

Hide Update and Delete Buttons

Override global UI action

https://www.servicenowguru.com/scripting/client-scripts-scripting/removing-form-buttons/

Mark Correct/Helpful, based on the impact of the response.

Regards,

Devyani

ChanakyaMekala
Kilo Guru

In the script, rather than using the already existed code, use normal delete statement.

 

Simple "current.deleteRecord()" would be enough. And if needed add necessary dialog boxes.

 

Below is an example for such:

 

function deleteClient(){
  if(confirm("Do you want to delete this record?")){
    gsftSubmit(null,g_form.getFormElement(),'deleteRecord');
  }else{
    alert("Record has not been deleted") ;
  }

}


if(typeof window == 'undefined'){
  myServerSideFunction();
}

 

function myServerSideFunction(){
  current.deleteRecord();
}

For this you should

1. Check Client check box. Then in the Onclick field you should mention client function. Here I have mentioned it as deleteClient() function.

2. Action name should be populated with appropriate name. Here I have mentioned it as deleteRecord.

Please mark Answer or Helpful if it had so.

Thank you..it worked.