how to update multiple records in target table from one record in source table in a transform map?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2018 03:06 AM
Hi All,
i have multiple records in a target table with the same user ID. As per the requirement i want to update all the records in target table using one source record.
i am using an excel with data for 5 fields. rest of the column data will remain same.
how can i achieve this?
Thanks,
KUMAR
- 4,543 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2022 03:38 PM
Hello,
I make it work today but writing an 'onAfter' script in 'Transform Map'. I am providing a sample script as below -
Scenario - adding comments aginst the user based on each department who are eligible for promotion.
Code
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var gr = new GlideRecord('sys_user');
var dep = source.u_user_department;
gr.addQuery('department', dep);
gr.setValue('comments', 'eligible for promotion');
gr.updateMultiple();
})(source, map, log, target);
Please mark it 'helpful' if it really helps you.......thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2020 11:00 AM
You can use below script in transform map to update multiple records of the target table for one source record.
answer = (function transformEntry(source) {
// Add your code here
//return ""; // return the value to be put into the target field
var gr = new GlideRecord('sys_user');
var goc = source.u_goc;
gr.addQuery('u_goc_code',goc);
gr.addQuery('active',true);
gr.addQuery('sys_class_name','sys_user');
gr.setValue('u_lvid', source.u_lvid);
gr.updateMultiple();
})(source);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2021 06:18 PM
Hello Chandan,
can you please specify where to use it specifically?
Is this can be used as a script on the main transform map or can be used as a 'onBefore' or 'onAfter' script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2020 12:14 PM
Was this successful for anyone? I am trying to implement the exact same thing.
I want to update multiple records in the target table ( the records are already existing) with one source record.
I believe it is possible but how ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2022 03:38 PM
Hello,
I make it work today but writing an 'onAfter' script in 'Transform Map'. I am providing a sample script as below -
Scenario - adding comments aginst the user based on each department who are eligible for promotion.
Code
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var gr = new GlideRecord('sys_user');
var dep = source.u_user_department;
gr.addQuery('department', dep);
gr.setValue('comments', 'eligible for promotion');
gr.updateMultiple();
})(source, map, log, target);
Please mark it 'helpful' if it really helps you.......thanks.