ATF FAILURE: Unable to insert record into table 'cmdb_ci_service'.

Community Alums
Not applicable

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

 

test case 1.PNGtest case 2.PNGtest case 3.PNG

 

Error 1.PNGError 2.PNG

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.

 

7 REPLIES 7

Check Uniqueness [Check Uniqueness for SN App Service ID] is the name of the business rule. If you update the name, does it work?

Khalid9030
Tera Contributor

@Community Alums 

Hello Dave,

i am getting same error. did you resolve it ? If Yes, please help me to resolve this issue.

Thanks in advance. 

Edxavier Robert
Mega Sage

I found this information - KB0955143

 

1. This error is thrown by an OOB business rule 'Check Uniqueness for SN App Service ID' - https://<instance_name>.service-now.com/nav_to.do?uri=sys_script.do?sys_id=c0d2f9e3b743001012ec2970ee11a9de
2. This is a new check introduced in Paris, where it checks if the value of the 'number' field of the service_offering record.
3. If it already exists, the BR throws this error.
4. To resolve this, please go to the table https://<instance_name>.service-now.com/cmdb_ci_service_list.do
5. Add the Number column and sort (z to a)
6. This will give you the last number on the table
7. Now go to the Number Maintenance record of the prefix above
8. Click Show Counter
9. Update the Number to the last number on the cmdb_ci_service table
10. Try to submit the Service Offering again, the error should not be thrown.