- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2020 02:26 AM
Hi,
I am trying to transform data with the below format. Is there a way to script in the previous records name, if the current record name is null during a transform?
Example:source table
Result:target table
it will a very helpfull thanks
Solved! Go to Solution.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2020 03:19 PM
Hi,
Use an onStart Transform script with the following code:
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var tmpName = '';
var sourceTable = map.source_table;
var importSet = import_set.sys_id;
var sourceGR = new GlideRecord(sourceTable);
sourceGR.addQuery('sys_import_set', importSet);
sourceGR.orderBy('u_value1');
sourceGR.query();
while (sourceGR.next()) {
if (sourceGR.u_name != 'null') {
tmpName = sourceGR.u_name.toString();
} else {
sourceGR.setValue('u_name', tmpName);
sourceGR.update();
}
}
})(source, map, log, target);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2020 01:12 AM
https://community.servicenow.com/community?id=community_question&sys_id=d365659d1bcc64d03222ea89bd4bcbae
please redirect to this question it will very helpful if u guide me thanks in advance