Force use of forms
Forms in todo4teams are available to 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 a ticket launch this way in todo4teams with the role "administratior", switch to the teams navigation item, select team X and edit it. Swith to the "Scripts" tab and paste the following script code into the "Create Action":
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.