Account.ID 0 evaluating as null

I’m setting up global variables for Autotask Account ID
If no account is found I have a final step to set it to a default account.

That final step is set to "Only perform this action if the following condition is met "
global.account.id == null

In the case where the account is our account and account.id is 0, the logic above is evaluating that the same as null and overwriting our account with the default account.

How can I get that to tell the difference between 0 and null?

Hi Rich,

The system use loose comparison when comparing two items with two equal signs (which the expression builder uses). Loose comparison treats null, 0, and false to all be equal.

If you use three equal signs, it uses a strict comparison. Strict comparison does not treat null, 0 and false as equal.

So, in your case, you’d want to use this to exclude matching account ID 0:

global.account.id === null

In order to use that expression, you will need to create a free-form field in the expression builder. You can create a new free-form field holding the SHIFT key on your keyboard when adding a new stanza, like this:

Let me know how that works!

Thank you Travis. That worked like a champ!