- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2019 09:38 AM
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
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();
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2019 11:34 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2019 01:46 PM
Have you tried using the out of box Delete UI Action? Seems like that would do exactly what you need.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2019 06:52 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2019 06:58 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2019 08:41 AM
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').