Pop-up message is not working in the List View of a table.

Chaithra Srini1
Mega Expert

Hi All,

I am working on one UI action to display a pop-up message in the list view and is not working. I am getting a pop-up message, but when we select a record and try to delete, the record is not getting deleted. Anyone can you please help me with this? Is this requirement feasible? because in list view current.deleteRecord() won't work as it is referring to current object and it works only in the form or single record and it won't apply for a multiple record. Can anyone please suggest any approach or ideas.

Regards,
Chaithra

find_real_file.png

This is the script I have written and is working in form view but not in list view:

function showAlert(){

if(confirm("Are you sure you want delete this record?"))

{
gsftSubmit(null,g_form.getFormElement(),'Test');

}
else
{
return false;
}
}

if(typeof window == 'undefined'){

myServerSideFunction();

}

//server-side function to delete the current record
function myServerSideFunction(){

current.deleteRecord();
}

1 ACCEPTED SOLUTION

Yeah. Since they work differently and getting the sys_ids (one or more in a list) while on the form its a single sys_id.

View solution in original post

15 REPLIES 15

The Machine
Kilo Sage

Have you tried using the out of box Delete UI Action?  Seems like that would do exactly what you need.

Chaithra Srini1
Mega Expert

Hi MB,

Thank you so much for your response. The OOB UI action is doing exactly what I need. I have verified in Incident and Change tables list view. I am trying to find the 'Delete' UI action using Form Configure > UI Actions and unable to find in Incident or Change or in Task table. Could you please help me how to find the OOB UI action script. So I can implement the similar logic in my custom UI actions. I have created different UI actions in different domain because this instance is having Domain separation and there are around 400 domains in it.

Regards,
Chaithra

Hi Chaithra,

What is the exact requirement here?

 

User selects 2 or 3 records and from the list choice clicks UI action; it should show some message to user confirming the delete action; when user clicks OK it should delete those selected records

this is the out of the box UI action for Delete from list choice; check the script

https://instanceName.service-now.com/nav_to.do?uri=sys_ui_action.do?sys_id=75a1fcce0a0a0b3400d6ed99cf8a87e0

why to have custom button if out of the box can handle this?

Regards

Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

It's in the UI Actions list like Ankur mentioned under the Global table.

You probably need to do an insert and stay in the TOP domain to cascade that to your other domains.  (I'm not a Domain separation expert so you might want to verify that).

Also, to have a delete button for a "custom role", what you do is do an insert and stay of the global delete UI Action.  BUT.  You change the table from global to your custom table, and leave everything else the same (specifically the action field).  This will override the global delete UI action on your custom table only.  And then you can modify the conditions gs.hasRole('my_custom_role').