Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Transform map for cmdb_ci_computer table

Community Alums
Not applicable

Hi,

I have a transform map where serial_number is the coalesce. But we need to avoid duplicates to create based on a custom field "corporate_number. So when importing the records, we need to make sure there is no record that has the same "corporate_number". If there is one, it should not update the record and throw an error. 

How can I achieve this?

For example, 

Serial_number            corporate_number

1234567                      123

7896325                      123

We don't want records like this in CMDB. 

Please assist

Thank you

1 ACCEPTED SOLUTION

Community Alums
Not applicable
Write an onBefore transform script. In the script glide record the using corporate number. If there is any entry that matches with corporate_number you can set ignore to true. (function transformRow(source, target, map, log, isUpdate) { // Add your code here var gr = new GlideRecord("cmdb_ci_computer"); gr.addQuery("corporate_number", source.corporate_number); gr.query(); if (gr.next()) { ignore = true; error=true; error_message='Corporate number duplicate.'; } })(source, target, map, log, action==="update");

View solution in original post

6 REPLIES 6

Community Alums
Not applicable

Thank you so much

cassieb_
Giga Guru

I would also suggest using the CI Class Manager to create an Identification rule based on the criteria you need to identify if a CI is to be updated or created for the CI being imported.