Can i change the source field Value using onBefore Transform Script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
23m ago
1. I have a scenario where i have to remove field value which contains "not availabe" to transformed as empty, source script for every field could not be the best scenario.
2. i wanted to change the source field itself from "not available" to "", can i do this using onBefore Transform Script.
function removeNotAvailable() {
var naLookup = {
'NA': true,
'N/A': true,
'NOT AVAILABLE': true
};
var sourceGr = new GlideRecord("u_test_supplier_data");
sourceGr.get(source.sys_id);
gs.info("Updated source field: "+ source.sys_id)
var value = (source.u_diversity_status_temporary).trim().toUpperCase();
if (naLookup[value]) {
gs.info("FOUND THE NOT AVAIALBLE: " + value)
sourceGr.u_diversity_status_temporary = "hello";
sourceGr.update();
gs.info("Updated source field: "+ sourceGr.u_diversity_status_temporary)
}
}
removeNotAvailable();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12m ago
not possible in onbefore script to manipulate source data
why not use onBefore transform script to handle your logic based on what's there in source field value?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7m ago
why not use onBefore transform script to handle your logic based on what's there in source field value?
i am already using the onBefore transform script to manipulate data, could you be more descriptive here
