Mandatory forms for groups


Forms in todo4teams are available tickets addressed to any team or user. In some cases you might want to make the use of a specific form mandatory whenever a ticket is addressed to a specific team.

Example: Team X handles complaints about project Y. You created a form "Y Complaints" that takes structured information about the case, e.g. product type, year of production, software revision etc.

Whenever a user addresses a ticket to group X you want to force the user to use form "Y Complaints" and to fill some important fields.

To configure this launch todo4teams with role "administratior", switch to the groups tab, select group X and click edit. Swith to the "Send action" tab and paste the following script code there:

result="success";
var theForm = helper.getMetaDataFromTaskByName("Y Complaints");
if(theForm!=null){
  var producttype = theForm.getValueByFieldName("Producttype");   
  if(producttype==null || producttype=="" || producttype=="?") {
    result="failure";  
    helper.errorMessage("Please select a product type!");
   }
} else {
  result="failure";  
  helper.errorMessage("Please use the form Y Complaints!");
}

The command helper.getMetaDataFromTaskByName tries to retrieve the form in question.  It will return null if the is not activated yet. The script result is set to 'error' then (preventing the ticket from being closed) and an error message is displayed.

It the form is activated we check if the field Producttype contains a value other than null or "?" and the error is handled like above.

     

Child Pages