I have a window calc to show and mandate a field if the Category is set to 'Other' on an incident:
import System static def GetAttributeValue(Incident): HideOtherCat = true MandateOtherCat = false if Incident.Category != null and Incident.Category.Title == 'Other': HideOtherCat = false MandateOtherCat = true return String.Format(":SetHidden(_OtherCategory,{0});:SetMandatory(_OtherCategory,{1});",HideOtherCat,MandateOtherCat)
At present, when I launch a new incident, the field is hidden and not mandatory. When I select the Category as Other, nothing changes until after I save the incident, at which point the field shows and is mandatory. This, essentially, allows techs to enter a category as other regardless of what the category actually is, and makes it the next tech's job to fill in the details of Other; the intent is to require our techs to enter details when they select Other, which should get them to just select the correct category the first time.
Am I missing something to make it work? Or is it working as expected?
I tried setting the calculation type to both Window Calculation and Before Save.