You have access to the Calculation dialog in conditional formatting. Set a global variable in your calc.
One problem with this idea, is that Conditional Formatting doesn't have one test. It can have many! Which one is evaluating true?
Now related to your actual issues...I don't recommend this, but you *could* put all your logic into custom functions. Whatever calc you use in the conditional formatting, but into a custom function instead. Put that custom function in the conditional formatting and in the script.
I doubt that there's any way to achieve this. I was just going thru the GetLayoutObjectAttribute function where, if exists, it would belong.
I think there's room to expand this function anyway though I recommend to have this forwarded to FMI as a feature request!
The purpose of conditional formatting, as I see it, is to give visual guidance to users—some sort of highlighting of fields that require data, revealing a button that can be used because some condition exists, etc. You determine the formulas that govern the conditional formatting; you can also use those same formulas to control other behaviour also, such as custom dialogs.
I'm with keywords on this: since you have to specify a test to format a field or leave it alone, it should be straightforward to use the same test in your branching logic.
Otherwise you are burying some logic on your layout instead of in your scripted workflow.
To avoid duplicating calculations you can use custom functions like David mentioned.
Thanks for the tips everybody!
First of all, I realized that I meant 1 or 0, not 1 or 2.
Second, I realized I was overthinking it. You are right, @wimdecorte, about the problem of burying some logic in the layout. Bad idea. The long if/then chain is obnoxious but probably the best thing. However, rather than exiting the script every time it encounters missing info, it occurred to me that I will just have it change the data in the z_ Evaluate field. That will make all the layout objects light-up and tell the user which layouts contain missing required data.