- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2017 06:44 PM
I have a data source/transform map from the import table to a newly created table. I have the need to update a field in another table from this transform map.
It's not doing anything and I have tried just 1 specific source.u_name and that didn't work either. What am i missing?
u_on_active_directory = field on a different table that needs to be updated from transform .
u_ad_computer = newly created table that the transform load into from import table.
Error : Invalid map target u_on_active_directory does not exist in table u_ad_computer = I got working by adding the 'On Active Directory' field to the u_ad_computer table as well. But now it doesn't seem to be doing anything.
Field map:
Script:
answer = (function transformEntry(source) {
// Add your code here
//Query Hardware table if fount set 'on Active Directory = true
var gr = new GlideRecord("alm_hardware");
gr.addQuery('ci.name', source.u_name);
gr.query();
var rec_count = gr.getRowCount();
//if (rec_count >= 1) {
if (gr.next()) {
return "true"; // return the value to be put into the target field
//answer = "true";
}
})(source);
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2017 08:12 PM
Not sure, its should work, I tried in this way and it worked for me. Let's see if this helps.
gs.log('u_on_active_directory :'+ source.u_on_active_directory);
gs.log('u_name :'+ source.u_name);
var gr = new GlideRecord("alm_hardware");
gr.addQuery('ci.name', source.u_name);
gr.query();
gs.log('count' + gr.getRowCount());
if(gr.next()){
gr.u_on_active_directory = source.u_on_active_directory;
gr.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2017 07:29 PM
is u_on_active_directory a boolean field? if yes, can you please try just returning true without quotes.
if (gr.next()) {
return true;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2017 07:21 PM
Yes, it is a Boolean. I made the change you mentioned below.
At that point the 'On Active Directory' field on u_ad_computer WAS updated! But the table/field in field map alm_hardware.u_on_active_directory' is still not being updated.
What am I missing in my script to ensure the target table/field is updated?
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2017 08:12 PM
Not sure, its should work, I tried in this way and it worked for me. Let's see if this helps.
gs.log('u_on_active_directory :'+ source.u_on_active_directory);
gs.log('u_name :'+ source.u_name);
var gr = new GlideRecord("alm_hardware");
gr.addQuery('ci.name', source.u_name);
gr.query();
gs.log('count' + gr.getRowCount());
if(gr.next()){
gr.u_on_active_directory = source.u_on_active_directory;
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2017 02:45 PM
Got it working... the Source_u_on_active_directory is not set until the end of this script, so I changed
gr.u_on_active_directory = source.u_on_active_directory; to
gr.u_on_active_directory = true;
This sets both fields on both tables !! Thanks for the assistance.