April 21, 2009

Delete delete for jobs


Many sites that use the Jobs feature do not want users to be able to delete a job once it has been created. There is a very simple trick using an undoc trigger feature to preventing deletion.

Simply add a trigger of the form:

jobsavior form-delete job "fail 'Jobs cannot be deleted' "

This takes advantage of the undoc special trigger action 'fail' which will always fail and return the arguments as the message. See 'p4 undoc' for more details.