- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2019 04:18 AM
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.
Solved! Go to Solution.
- Labels:
-
Problem Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2019 05:06 AM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2019 04:21 AM
Did you write the code inside a confirmandeletefromForm function? If yes, can you share the code of that to debug.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2019 04:28 AM
Hi,
Have a look on below threads, this will helps you.
Hide Update and Delete Buttons
https://www.servicenowguru.com/scripting/client-scripts-scripting/removing-form-buttons/
Mark Correct/Helpful, based on the impact of the response.
Regards,
Devyani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2019 05:06 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2019 12:28 AM
Thank you..it worked.