Need to modify the field script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2025 12:37 AM
HI Community,
I have written a field script in transform map, when class is t/a/ga/e then it should update as 'e' which is working fine but when there is empty value from source then it should not update as e or ext currently i guess it if the class is empty then it is updating as ext but it should update as empty
How can i modify the script:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2025 01:56 AM
What type of field is
source.u_employee_class
Are you sure it is empty and not containing some value?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2025 02:54 AM
HI @sergiu_panaite ,
Yes in source table i checked that particular field (employee class) it is single line field and for some records we are receiving empty value.
In employee class field (source table) we will be receiving values as A T GA E EXT and empty so now for empty it is updating as ext it should update as none
In transform map, HR profile is the target table and we are mapping the employee type field in hr profile with this field script.
HR Profile field:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2025 12:50 AM
you can try this
answer = (function transformEntry(source, target /*, map, log, action*/) {
// normalise the incoming value
var zone = (source.u_employee_class || '').toString().trim().toUpperCase();
// ─── 1. no value in the source ──────────────────────────────────────────────
if (!zone) {
return ''; // leave the target field blank
// ─or─ return target.u_employee_class; // keep whatever it already had
}
// ─── 2. T / A / GA / E → "E" ────────────────────────────────────────────
if (zone === 'T' || zone === 'A' || zone === 'GA' || zone === 'E') {
return 'E';
}
// ─── 3. anything else → "EXT" ───────────────────────────────────────────
return 'EXT';
})(source, target);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2025 01:46 AM
@suuriyas did you try this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2025 02:57 AM
HI @Hristo Ivanov ,
Thanks for your response, but i don't understand the script.
I have written a field script and map it to the employee class in hr profile table ( target table).
In source table i checked that particular field (employee class) it is single line field and for some records we are receiving empty value.
In employee class field (source table) we will be receiving values as A T GA E EXT and empty so now for empty it is updating as ext it should update as none
In transform map, HR profile is the target table and we are mapping the employee type field in hr profile with this field script.