Coalesce in transform but update multiple records

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2019 05:20 AM
Hi Community,
I have a data source that includes all of the 'titles' of the software installation table records.
I need to use that datasource to flag \software installations. Target table is cmdb_sam_sw_install
I have the transform script and map sort of working, but need to coalesce on the display name and version to ensure I don't create records and only update existing ones.
Does anyone know a way to update all records with the same display label but still coalesce ?
Example (not real):
The source database tells me the flagged category (custom field) of any software installation called "Chrome" should be 1 if the version is < 9
There are 200 computers with Chrome 8
How can I update all of those 200 records whilst still coalescing on version and display label - default behaviour is to update just 1 of the records.
Is it possible, for example, to pull all the sys_ids for the matching records and dynamically add them to the transform map, and then coalesce on sys_id ?
Thanks in advance for any assistance,
John
- Labels:
-
Enterprise Asset Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2019 05:38 AM
Hi John,
It sounds weird, but you can do it using onbefore transform script.
var category = source.getValue("u_category/whatver your source field name");
var gr = new GlideRecord("table name which ever records you would like to update");
gr.addQuery("give dictionary name which ever you would like to compare",category);
gr.query();
while (gr.next()) {
gr.fieldd1 = value1/source.getValue("value1 field name");//In case if you want to update values from the sheet.
gr.field2
.
.
like wise goes on which ever fields you would like to update
gr.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2019 07:11 AM
Hi,
Thanks for the answer. Do you mean a transform script or a field mapping script.
If a transform script, the TransformRow function needs to be called doesn't it ?
John

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2019 07:18 AM
Hi,
Yes transform script not field mapping script.
You can use the above code it will work nothing else to do.
Regards,
Harish Murikinati.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2019 07:29 AM
Hi John ,
Based on your logic you might also need to use ignore=true in your transform script . It will prevent unnecessary records to create or update .
Thanks
Mukesh Sharma