Do not update coalesce field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2017 08:08 AM
Using Istanbul...
I have a 2 column CSV file to import. Column A is my Coalesce field. Column B contains data for the field I want to update.
For some rows in my CSV, the case of the Coalesce field (column A) isn't the same case as what is in the CMDB. For example, the CSV may contain "abc" but the CMDB contains "ABC". These match (which is what I want), so data from column B of my CSV is being updated. But what is also happening is the Coalesce field is being updated from "ABC" to "abc" (which I don't want).
Is there any way I can prevent the Coalesce field from being updated when their case doesn't match?
Thanks,
Ron
- Labels:
-
Discovery
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2017 08:20 AM
*deleted previous reply as I didn't read it correctly
If you want to ensure it is always capitalized, you will need to use a source script.
something like
var str = source.<columnA>;
return str.toUpperCase();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2017 08:23 AM
Actually, I don't want to cause an update of the Coalesce field (column A) at all. If there is a match, regardless of case, I simply want to update column B.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2017 08:33 AM
It will only update it the first time. Every time after that they will already be uppercase (or lower if you prefer)
i don't think it would be worth the effort and maintenance headache to implement what you are suggesting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2017 08:06 AM
The way I did it was to create the field mappings as normal but use a script on the coalesce field to lookup and return the existing value. It's not as good as being able to say "Coalesce but don't update" but it does the job and is simple to do.
Example -
Serial Number is the coalesce field and I want to make sure it remains the same (no case change), only Name should be changed.
2 field mappings:
Serial Number (script)
Name (auto match)
Serial Number Source Script:
answer = (function transformEntry(source) {
var gr = new GlideRecord('cmdb_ci');
gr.addQuery('serial_number', source.u_serial_number);
gr.query();
if (gr.next()) {
return gr.serial_number;
}
})(source);
(Server side addQuery is case insensitive and that suits me in this case, but bear it in mind)