- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2021 01:22 AM
I am giving the input as numbers ...ex(11011748,11011749)
I am trying to check for an empty string.
but it returns empty , even if i enter a string. -> (11011748,11011749)
Code sample
answer = (function () {
if(current.variables.clabel === "") //-----> my code to check the empty string
{
workflow.scratchpad.comments = 'Given label is Receiver Label';
return 'no';
}
return 'yes';
})();
please help
Solved! Go to Solution.
- Labels:
-
Request Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2021 01:32 AM
Hi,
simply use this
gs.nil() method
answer = (function () {
if(gs.nil(current.variables.clabel)) //-----> my code to check the empty string
{
workflow.scratchpad.comments = 'Given label is Receiver Label';
return 'no';
}
return 'yes';
})();
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2021 08:47 AM
i tried marking both the answers a correct
gs.nil(current.variables.clabel))
current.variables.clabel.nil()
both seems to be correct, i tired to mark both as correct,
but the algorithm accepts only one...
other gets disabled...
sorry for that...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2021 08:52 AM
No worries.
You can mark whichever you used and worked well.
Stay safe.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2021 01:48 AM
Hi,
hmm, === operator should work , but you can use gs.nil as Ankur stated or nil()
(current.variables.clabel.nil())
mark Correct✅/helpful if applicable, thanks!!
Aman