Coalesce multiple fields in transform map to make updates in the target table through import sets

Sumanth5
Kilo Contributor

Hello All,

 I have a transform map where I need to coalesce two unique fields to check the fields and update the existing records in the target table through the import sets. We are importing data through the import sets and transforming the data through the transform map. We'll be updating our existing records and at the same time creating the new records through the import sets. For the update scenario I have coalesced two fields say A, B and the rest of the fields are C,D.After setting the two fields A,B to coalesce true in the field map, I tried to update the records(updating Field C) in the target table through the import set, but it is creating a record instead of updating the existing record(for field C). Please advise me on this, thanks!

8 REPLIES 8

You say that you're matching it to the reference in the target field.  Do you have the correct target field selected that matches the data that you're sending?  Also, is that data clean meaning no white spaces around the words?  In the example, you would need to send an email address in the source to map to the the email field  for the target. 

HI Wesley,

 

Yes, the matching are accurate and there is now whitespace. 

Hey Sam can you share the fields please which you're coalescing on. 

 

Also a dummy data which is getting created instead of getting updated

Hi Varun,

 

I'm coalescing on u_sys_id_apps(app is the target name) ans u_sys_id_groups(group is the target name).

 

For example I'm passing a bid:1234567 through import set and same way passing groups id:22467 (did and group id being taken from other tables). After passing these in the transform map I'm queuing on app table and groups table so it populates the app and groups name in the expected target table.

 

Existing Record:  App   Group    Active     Role

                         App1  Group1  True      10

 

Updating the role here to 11 so it should be updated the role field only as 11 instead of 10 but it is creating an another records with all the data and role as new 11.

 

I tried to use the field map on coalesce field (for example app script) but when I'm using these field scripts instead of transform script no record is passing through and the import set is being skipped.

/**
* Find Parent App based on dbid, return SysID
**/
answer = findref(source.u_sys_id_apps);

function findref(dbid, sys_id_apps) {
var ref = new GlideRecord("u_cmdb_ci_Fbbase_application");
ref.addQuery("u_dbid"," source.u_sys_id_apps");
//CI.addQuery('install_status', '!=', 14);
ref.query();
if (ref.next()) {
return ref.sys_id.toString();
}
return "NoMatchFoundIgnoreThisRecord"+source.u_sys_id_apps;

}