- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2020 03:09 PM
To make a long story short, I've tried a number of things and am unable to create and IF branch in a flow that runs only when a task field is NOT empty. The goal is to send out approvals to the individuals in an "additional_approvers" field if that field contains values, otherwise the flow ends. Is there any reason why simply using the IF conditional set to "is not" then leaving the next field blank shouldn't work for this?
Alternatively, would it be reasonable to create a custom action that might return T/F based on whether input is null, as a workaround?
Solved! Go to Solution.
- Labels:
-
Workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2021 01:58 AM
In old version, We are using "is not" from filter and leave as black but in latest version(Quebec) we have OOTB functions.
ServiceNow has provided OOTB box utilities functions. We can call the function to check the data pill is blank or null value.
Please find the reference screenshot.
For more information. Please refer below link
https://docs.servicenow.com/bundle/quebec-servicenow-platform/page/administer/flow-designer/reference/utilities-transform-functions.html#d1097001e249

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2020 03:19 PM
I get where you're coming from on your requirement. You may be over thinking this.
Why not pass the list of additional_approvers to the approvals whether it's empty or not? Let the next action figure out if it needs to send info or not?
Alternatively, you could create a simple action that takes a field and returns a true/false "if is empty"
Let me know if I'm not understanding the requirement entirely.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2020 03:05 PM
Hi Chuck, thanks for thinking about this. Yes, I think for our purposes right now we will just do as you suggest and pass the approvers even if it's empty. The case where there are none really is not of concern anyways since those would be applications that the HR caseworker closes prior to this stage anyway. So I don't strictly need to do this flow control based on if the variable exists.
Regarding creating a custom action to return T/F based on whether the input was null, yes I tried it once the default IF ('x' is not) ______ approach seemed to fail but the behavior there was curious. I tried it this way (tried to design to accommodate various "falsy" objects since it's not clear what exactly gets into the JS environment for execution):
(function execute(inputs, outputs) {
if (!inputs.approvers){
outputs.out1 = false;
} else {
outputs.out1 = true;
}
})(inputs, outputs);
The action works in the action testing environment and returned T/F as expected whether input was left blank or not, but when the action was put into the context of the flow it returned as T in all cases as if the value was never missing/empty.
It's like the empty value is still being passed into the action as some kind of object?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2020 03:40 PM
What data type is inputs.approvers in your action?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2020 08:23 AM
The field is a list collector referencing sys_user where one can select multiple users. In the custom event, I tried a couple of things but I think mostly was testing it with the data type set to string, thinking it may not be critical since I just want to check "if exists", but perhaps it must be more properly matched to the data type of the field on the glide/DB side?