Add 'Delete Button' to Incident Related List on Problem Record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-11-2024 03:20 AM
I want a Delete UI action button to the added beside the Add button on the Incident-related list tab on a problem record so that clicking the delete button will only remove any selected incident that was formerly associated with the problem record and should not delete the Incident record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-11-2024 05:34 AM
Why manually, when we have OOTB edit button, enable it and your lifewill be easy.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-11-2024 06:24 AM
You can create a delete button on the table in question , sample below
function deleteInformation() {
var relationId = "";
//list context menu click
if(typeof g_sysId == "undefined") {
if(g_list.getChecked() == "") {
g_form.addInfoMessage(getMessage("Select a record to delete."));
return;
}
}
else
relationId = g_sysId;
if(relationId == "") {
var checked = g_list.getChecked();
var checkedSplit = checked.split(',');
if(checkedSplit.length > 1) {
g_form.addInfoMessage(getMessage("Select a single record to delete."));
return;
}
relationId = checkedSplit[0];
}
var answer = confirm(getMessage("Do you want to delete the record? "));
if(answer === true) {
//call business planner function
var ga = new GlideAjax("<call script include>");
ga.addParam("sysparm_name", "<function name>");
ga.addParam("sysparm_relation_id", relationId);
ga.getXML(function(response){
location.reload();
});
}
else {
return false;
}
}
You will also need to create script include to catch the sys_ids and delete them using a simple glide record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-11-2024 06:44 AM
you already have Delete here in List Choice and you can select the INC and once you click Delete it will delete those selected INC records
Why to have new one?
You just need to ensure user passes the correct ACL for Delete on INC table
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-12-2024 05:39 AM
Hi Ankur,
I want a delete button on an incident-related tab on the problem record, which only removes that incident from list of records and not to delete INC from system. I have Add button which adds a particular incident from incident table to the problem record so to remove that i want delete button to remove that INC record from problem record, not to delete from system.
quite confusing hope your getting my point!!!
Thanks,
Sayali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-11-2024 08:45 AM
Hello @Sayali_9822 ,
You can show OOTB Delete UI actionon list banner on incident list records. See the below link this is the OOTB UI action for delete button. You just need to make 'List banner button' "True" and it will show up on banner list of incident Record.
*****Make sure to change 'instanceName' with your instance name. otherwise link will not work.
See the result:
Kindly mark the answer āļøCorrect or Helpful āļøIf it addresses your concern.
Regards,
Siddhesh