I don't use the string.format stuff because it becomes too hard to alter with lots of fields.
I will simplify it for troubleshooting. The following works if I select a category, but the calculation fails when i change it back to null, by clearing selection.
import System static def GetAttributeValue(Activity): Value = '' TermDateMand = false if Activity.Category != null: TermDateMand = true Value = Value + ':SetMandatory(_DateEmpNotified,' + TermDateMand + ');' return Value