Transform map is not updating one specific field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2020 09:09 AM
Hello All,
We have SCCM 2016 integration/plug in in place. The requirement is to clear a value in the target table before one of the data sources and the transform map runs, so that transform map can populate that value as a new value every time. I created an "On Before" transform script (Since I need to delete the value before transformation, I am using on before) and with that I am able to clear the value in the target table. However, transform map is able to update all other information on the target record except the one I am clearing via on before script. Any idea why transform map is not able to populate/update just that one field? Also is there any documentation available to understand the SCCM 2016 integration better?(Apart from ServiceNow docs). Thank you.
My on before transform script:
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
var rId = source.u_id;
var bios = source.u_number;
var gr = new GlideRecord ('cmdb_ci_computer');
gr.addQuery('correlation_id',rId);
gr.query();
if (gr.next()){
if (bios == gr.number){//If this value matches with target record, do nothing.
return;
}else{
var gr1 = new GlideRecord('sys_object_source');
gr1.addQuery('id', gr.correlation_id);
gr1.query();
while(gr1.next()){
gr1.deleteRecord();//To delete records from the sys_obj_source.
}
gr.correlation_id = '';//To set the value on my target table as blank.
gr.update();
}
}
})(source, map, log, target);
Regards,
Mnreddy.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2020 09:19 AM
Are you receiving an error message or does everything run successfully, and the field is left blank?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2020 09:33 AM
Everything runs successfully and I don't see any errors in the transform logs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2020 10:58 AM
https://community.servicenow.com/community?id=community_blog&sys_id=69ada2a9dbd0dbc01dcaf3231f961996
This article was very helpful for me. If you have any field-level scripts, there is a comment that mentions how these come into play.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2020 09:35 AM
Did you try directly updating the new value at once instead of clearing out? Not sure why you are clearing out.
you can use
gr.correlation_id = source.FIELD_NAME//instead of gr.correlation_id = ''.
//Replace FIELD_NAME with the actual source name.
Above script would simply put the source value as a new value in the field irrespective of old value.
Kindly mark mu answer as Correct and Helpful based on the Impact.
Regards,
Chaitanya