- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2025 03:58 AM
Source File has a field Vendor id and mapping this field to a dot walking field on the target table.
Here is the script i am trying in onbefore. After running the transform the value of the target field is empty.
Pls suggest
if (source.u_cmp_vendor_id_l3 != '') {
var vndID = new GlideRecord('core_company');
vndID.addQuery('u_number', source.u_cmp_vendor_id_l3);
vndID.query();
if (vndID.next()) {
target.x_cy_tr_entity_new_name.u_number.setDisplayValue(source.u_cmp_vendor_id_l3);
} else {
log.warn('Vendor id not found');
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2025 04:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2025 04:03 AM
@SAS21 Your OnBefore Script runs before the actual transformation occurs, so it’s likely not correctly assigning the reference value to the target field.
just verify with following script:
if (!gs.nil(source.u_cmp_vendor_id_l3)) {
var vndID = new GlideRecord('core_company'); // Check if this is the right table
vndID.addQuery('u_number', source.u_cmp_vendor_id_l3); // Match Vendor ID
vndID.query();
if (vndID.next()) {
target.x_cy_tr_entity_new_name = vndID.sys_id; // Assign sys_id, not setDisplayValue
} else {
log.warn('Vendor ID not found: ' + source.u_cmp_vendor_id_l3);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2025 04:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2025 04:50 AM