Checking if an Object is Null
- Updated on 09 May 2013
- 2 minutes to read
TheObject Is Null component checks whether a given input is "null," or non-existent. Based on its determination, the component returns a "True" outcome if the input is null, or a "False" outcome if the input object(s) exist.
To add the component to a flow, in the Toolbox panel, in the category Data , drag anObject is Null component to the workspace.
Our example flow will illustrate how the Object Is Null component works by retrieving a folder at random and evaluating its output as either a null or non-null value.
Begin by navigating to a project folder and selecting the Create Flow button. Give the flow a name and click OK to open it in the Flow Designer. To start building the flow, in the Flow Designer's startup window, under the category Integrations > All Integrations > Internal Services > FolderService , we select a GetByID component and click Add to add it to the workspace. This component retrieves a folder by its unique ID to be used as input for our Object is Null component.
Next, select the Object Is Null component from the Flow Designer's startup window, under the category All Steps [Catalog] > Data , and click Add to add it to the workspace.
In a production scenario, we'd likely direct our flow to two very different outcomes, depending on which value Object Is Null 1 returns. For the purposes of this example, however, connect both the True andFalse outcomes to the End Step .
To tell the Get By ID 1 step what folder to evaluate, in the Properties panel for the step, click on theShow Mapping Editor link to map its inputs. Since we are not retrieving a specific folder first, simply select Flow Data > FolderID .
This will return no folder data because no folder actually exists.
To set the value it's checking,Object Is Null must have an input mapped. Select Object Is Null double click to Show Mapping Editor to map its inputs.
Inside the Mapping Editor, we will map GetByID1_Output to value , then clickOK to save our change and return to the Flow Designer .
Our flow is complete.
When we run it in the debugger, Object Is Null 1 identifies the output GetByID1_Output as a null object and returns a "True" outcome, listed in the Events tab ("outcome: True")
To evaluate an actual folder, an option is to hard code a folder ID. It is possible to retrieve a folder ID in the portal by browsing the folder URL. Mapping this as a constant input value will make the Object Is Null 1 step evaluate False, assuming there are entities within that folder.