Transform map script issue -- scoped application
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 10:24 PM
Hi Team,
I have requirement where I need to check if a source field is empty in an excel file while import and trigger a notification based on that.
For example: I am receiving Task number(s) in excel which needs to be processed further. Now there are some scenarios where this file could be empty as you can see in attached; in that case I need to trigger a notification to relevant people.
I am seeing an issue where I am not able to read 'Task number' field using onbefore transform map script. If value of Task number is present then onbefore script is working, however if field is empty and we try to read the value by using below and try to print the same, it is not retuning anything.
var task_number = source.u_task_number;
gs.info(task_number);
My assumption is that if file is empty, above code should return empty value/string.
Could someone please redirect me to the right direction and let me know what I am doing wrong?
Best Regards,
Naveen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 10:34 PM
you can try to check null value as well
var task_number = source.u_task_number;
if(task_number == '' || task_number == null){
// your logic here
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 10:40 PM
Thank you for your prompt response!
Let me try that, will update you soon.
Best Regards,
Naveen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 10:52 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 11:01 PM
without you sharing complete script we won't be able to help.
also share screenshots.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
