I'm trying to trigger an email notification when a user-input percentage value crosses the 80% threshold. It should only trigger when the value crosses 80%, as this form will be resubmitted multiple times until a project gets to 100%, but we only want notification on that 80% cross.
I'm trying to get to this information via the form's .initialData versus .data parameters.
I've got the email script setup as a trigger event handler on a successful form submit. This trigger is limited by an "only run when" condition, which is the part I'm trying to figure out.
Current "only run when" script:
(if initialData is less than 80% AND if new data is greater than or equal to 80%, true)
{{
operationsReviewForm.initialData.Opertions_PctWorkComplete.valueOf() < 0.80
&&
operationsReviewForm.data.Opertions_PctWorkComplete.valueOf() >= 0.80
? true : false
}}
I've tried various combinations of parentheses to no avail. Tried with/without the .valueOf().
Each individual condition (without the &&) evaluates erratically, sometimes true, sometimes false - which makes me wonder if it's even possible to evaluate this .initialData and .data properly.
This shows the email script code and output from some successful emails without the &&.
State of my form showing the numerical differences before a Submit:
So it seems like the data is all there and outputting to the email, but I can't get the greater thans or && to evaluate properly. Any ideas?