Very helpful, thanks. Seems like I was missing the part where it is necessary to declare the attribute variables from the table that are to be used in the script...?
Expects($feature, 'COLOR')
//$feature.COLOR;
var fieldName = 'COLOR'
return $feature[fieldName]
The documentation, found at the link you provided:
You should explicitly list all field attributes that will be used at the top of the expression. This will ensure the profile will request the appropriate data from required fields so the expression evaluates properly.
$feature.COLLEGE;$feature.POPULATION;
Round(($feature.COLLEGE / $feature.POPULATION) * 100, 2);
Alternatively, you may use the Expects function for this purpose. Expects($feature, "COLLEGE", "POPULATION");
Round(($feature.COLLEGE / $feature.POPULATION) * 100, 2);