nil() function is not working in scoped application in onbefore transform script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2022 07:13 AM
HI Team,
I want to check the condition in onbefore script of a scoped app with conditions, if the source field does not contain "vplex" field or the source field is empty we have to ignore the record. the code is working for first condition but it is not working for nil() condition.
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
if((source.u_alias.toLowerCase().indexOf('vplex')== -1) || (source.u_alias.nil()) )
ignore = true;
})(source, map, log, target);
Kindly let me know, what is the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2022 07:16 AM
you can use source.u_alias==''
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2022 07:28 AM
Hi,
please use OOB ServiceNow JSUtil class. It works in global + scope app
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
if(source.u_alias.toLowerCase().indexOf('vplex') == -1 || global.JSUtil(source.u_alias))
ignore = true;
})(source, map, log, target);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader