Transform Map - Update CI's that match on Serial Number and are in status=Ready

Owais3
Tera Expert

Hey all.

 

I've got a Transform Map setup to update CI's, I've done coalesce on serial_number and I also have a onBefore Transform Script to only update CI's that are in status=Ready.

 

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {

    // Add your code here
    if (target.operational_status == 6) {
        ignore = 5;
    }
	
})(source, map, log, target);

 

However, I still get the following error when running the Transform.

More than one target records exists for target table cmdb_ci_computer with query serial_number=XXXXXXX

 

Any idea what I am be doing wrong?

Thanks

1 ACCEPTED SOLUTION

Manmohan K
Tera Sage

Hi @Owais3 ,

 

You are not doing anything wrong but you have faulty data in the system.

Check with the serial number on target table - cmdb_ci_computer, if it shows multiple records then you have to clean up the data and make sure there is only one record for a serial number.

Since you have chosen serial number as coalesce field, you must maintain unique serial number for each record in the system

View solution in original post

2 REPLIES 2

Manmohan K
Tera Sage

Hi @Owais3 ,

 

You are not doing anything wrong but you have faulty data in the system.

Check with the serial number on target table - cmdb_ci_computer, if it shows multiple records then you have to clean up the data and make sure there is only one record for a serial number.

Since you have chosen serial number as coalesce field, you must maintain unique serial number for each record in the system

Thanks @Manmohan K 

 

We are looking into getting the data sorted, however, in the meantime I need to update the CI's that are in status=Ready,

 

I was thinking of doing a similar script on the serial_number field in the Transform Map to basically match on serial number and update the matched ci if the status is ready.

 

Would you have an example script for this?