ATF FAILURE: Unable to insert record into table 'cmdb_ci_service'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 01:09 AM
Hi,
I have written a test case and it is failing on the error
FAILURE: Unable to insert record into table 'cmdb_ci_service'. Details:
Operation against file 'cmdb_ci_service' was aborted by Business Rule 'Check Uniqueness for SN App Service ID^55cb4dbc1bd039903e27fd9f034bcb66'. Business Rule Stack:Check Uniqueness for SN App Service ID
Business Rule
(function executeRule(current, previous /*null when async*/) {
var curNum = current.number + '';
if (current.operation() == "update" && previous != null && curNum == (previous.number + '')) {
// For Update, if number has not changed no need to verify uniqueness
return;
}
if (JSUtil.nil(curNum)) {
gs.addErrorMessage(gs.getMessage("Invalid {0}. The number field cannot be empty.", [current.operation()]));
current.setAbortAction(true);
return;
}
// When Inserting new record or when value of number has changed, verify uniqueness
var gr = new GlideRecord("cmdb_ci_service");
gr.addQuery("number", curNum);
gr.query();
if (gr.getRowCount() > 0) {
gs.addErrorMessage(gs.getMessage("Invalid {0}. Service with SN App Service ID: {1} already exists.", [current.operation(), curNum]));
current.setAbortAction(true);
}
})(current, previous);
I can easily make the Test Step false and make it run, But I want to know what is going on. Kindly help.
Regards
Suman P.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 06:05 AM
I'm thinking you ran this ATF and it failed but instead of rolling back all the changes, it left a business service named Sample ATF Business Service. If it exists, delete it and then try your ATF again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 06:16 AM - edited 07-25-2023 06:17 AM
Hi @Michael Fry1 ,
Thank you so much. I tried it, but there is no entry with Sample ATF Service.
Regards
Suman P.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 06:27 AM
There is a sysID in the error. What record comes up when you look for that sysID? Try adding a 1 or 2 to the end of the name.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 06:40 AM
Hi @Michael Fry1 ,
I tried looking for sysid with 55 as it contained 55 in the error. I got some results, but there is no 'Check Uniqueness'.
Regards
Suman P.