How to delete the record in asmt_metric table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2025 05:41 AM
Hi,
I am not able to delete the record in asmt_metric table.
Do we need to do with any ACL's if yes please let me know.
Can anyone please help on this, It will be gratefull
OOB ACL's:
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2025 05:53 AM
Hi @mania
I tried in my PDI and i am able to delete the record from asmt_metric table without any issue. i have admin role. Please check the delete ACL what role is required .
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/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2025 06:46 AM
Please check if somebody updated the ACL for admins.
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
3 weeks ago - last edited 3 weeks ago
@mania
Were you ever able to figure this out? I just ran into the same thing and discovered there is a canDeleteMetric function being called from the AssessmentUtils Script Includes that controls when a Metric from asmt_metric can be deleted.
For my use case, I had to delete all records from the Metric Results (asmt_metric_result) table that were tied to the Metric that needed to be deleted. Once that was complete, I was able to delete the Metric.
canDeleteMetric: function(metricGR) {
var metricResultGR = new GlideRecord('asmt_metric_result');
var canDelete = true;
if (metricGR != null) {
if (metricGR.datatype == 'attachment') {
metricResultGR.addQuery('metric', metricGR.getUniqueValue());
metricResultGR.query();
var metricResultSysID = [];
while (metricResultGR.next()) {
metricResultSysID.push(metricResultGR.getUniqueValue());
}
var attachmentGR = new GlideRecord('sys_attachment');
attachmentGR.addQuery('table_name', 'asmt_metric_result');
attachmentGR.addQuery('table_sys_id', 'IN', metricResultSysID.join());
attachmentGR.query();
if (attachmentGR.hasNext())
canDelete = false;
} else {
var encodedQuery = 'metric.datatypeINdate,datetime,string^string_valueISNOTEMPTY^metric=';
encodedQuery += metricGR.getUniqueValue();
encodedQuery += '^NQmetric.datatype=reference^reference_value!=-1^metric=';
encodedQuery += metricGR.getUniqueValue();
encodedQuery += '^NQmetric.datatypeINchoice,imagescale,scale,multiplecheckbox,long,numericscale,percentage,ranking,template,boolean^actual_value!=-1^metric=';
encodedQuery += metricGR.getUniqueValue();
encodedQuery += '^NQmetric.datatype=checkbox^metric=';
encodedQuery += metricGR.getUniqueValue();
metricResultGR.addEncodedQuery(encodedQuery);
metricResultGR.query();
if (metricResultGR.hasNext())
canDelete = false;
}
}
return canDelete;
},
