Setting hidden content fields

How do I editing hidden fields, except by changing their Visibility in the Workbench, editing them in Content Explorer, and then hiding them again? That worked, but is that the right way to set their values?

I have a Generic content item, which my location scheme is successfully publishing to a special PgScript template. But it kept publishing as script.html instead of script.js until I changed the hidden field sys_suffix to “js” in Content Explorer.

To change that field, I added this line in my page template without success. I’m sure I’m doing it wrong. Even the Workbench didn’t like the syntax:

#set ($dummy_variable = $sys.item.getProperty(sys_suffix).setValue(java.lang.String 'js'))

Not only is the right way, it’s the only way.

Dave