Tuesday, July 1, 2014

In Dexterity - Passing in a checkbox for a boolean parameter results in it flipping the value

I'm passing a checkbox field, specifically CMTransactionObject:'Auto Post To GL', to a script which is expecting a boolean. 'Auto Post To GL' is a checkbox type.

I put warning messages, like this warning str(CMTransactionObject:'Auto Post To GL') before the script is called, and then as the first statement in the script itself.

Before script - 1
In script - 0

Explicitly cast the checkbox to a boolean.

Way 1-
local boolean value = CMTransactionObject:'Auto Post To GL';

call script, value;

Way 2-
call script, boolean(CMTransactionObject:'Auto Post To GL');
This way should not be done with inout parameters, only in.

This actually seems to be caused by passing a local variable to two different parameters, one with in one with inout

No comments:

Post a Comment