Conditional formatting is a property that you apply to a layout object while in layout mode. It appears that you have defined a calculation field rather than used a conditional format. (I guess that you could say that this field has a conditional value. )
If you run this script and then use the mouse to click a blank area of the layout, do you then see this field display the expected value?
If so, you just need to add a commit records step immediately after the set field step.