Python booleans returned to workflows do not behave as expected

TL;DR = We ran into an issue with how workflows handle integer values assigned to boolean operators while working with Professional Services to build out a workflow and I agreed to share this here for further review…

We’re trying to figure out if this is a problem with how InsightConnect interprets Booleans from Python steps in our workflow or if we were just doing something incorrectly. This issue was “solved” by returning an explicit value of “True” or “False” instead of “0” or “1”, but we thought it strange that returning an integer for a Boolean variable in a workflow did not result in the value being correctly converted to it’s True/False equivalent. Based on our testing, we believe this is not necessarily a “bug”, but just an oversight in nuances between how Python and the InsightConnect backend (Golang?) interpret integer values for boolean variables.

To reproduce:

  1. Our python script checks the domain from the sender of an email
  2. If sender domain matches our whitelist, a value for “1” (Python equivalent for True) is returned to boolean variable in the workflow
  3. A Filter step in the workflow checks the boolean variable and should allow the workflow to proceed if it is True

Issue:

  • The workflow “should proceed” because the “1” value returned from Python is equivalent of “True”
  • However, the workflow does not proceed because the “1” value returned from the Python script is not interpreted as “True” by the InsightConnect backend

Screenshots:

python_boolean_example

1 Like

Example Jobs testing Workflow based on “1” or “True” values.

python_boolean_example_proof_0

python_boolean_example_proof_1

1 Like

That is solid feedback. We will discuss this internally. I think your assessment of python vs the back end is correct, but we’ll need to look into it further.

Thanks again.

I submitted a ticket for this for our teams to look at it.

In the meantime, you can say something like “If good == 1 OR If good” to get around this. It’s not as slick as just using truthy values, but it’ll work.