Checking a value exists in a script & debugging scripts

My script seems to fail when the variable is not set as the attribute it reads from is similarly empty.

I’ve looked the Yotta Task Indicators workflow (workflows_yottaComputeTaskIndicators_629f4adf98d0d101c4f9c5c9) and this scripts in some conditionality as follows:

“script”: “if (issued_time.HasValue && completion_time.HasValue) {return (completion_time.Value - issued_time.Value).TotalHours;};”,

I have tried a similar approach in my script as follows:

“script”: “if (checker_time.HasValue){return ((reviewer_cost.Value * reviewer_time.Value)+(checker_cost.value*checker_time.value));}else {(reviewer_cost.Value * reviewer_time.Value)};”

When this runs, this gives me an error saying

“error”: “‘double?.value’ is inaccessible due to its protection level”

What have I done wrong? How am I best debugging the scripts themselves?

The workflow is “workflows_fRMWKFLPlanningReviewComplete_6368c2fed76320038c3bb655”

Hey Chris, first glance here it looks like you have lowercased properties “.value” that most likely should be “.Value”

I’d suggest reaching out to our support team if you need some more help writing or adapting some workflow scripts :+1: