Custom fields

Custom fields are available on tasks, resources, issues, assignments, worklogs and costs.

Administrator can create new custom fields from “admin” –> “Customizations” : for instance clicking “on task”

Once fields are defined you will find them on the respective editors; in task editor for instance

screen971

Notice that field input validation is active; number are treated as numbers so the dates, the boolean and the Person too.

You can also search / filter by these fields in the task search page:

screen973

There are many option to define each field.

Here some custom field examples:

  • Unused field: no -> the field is inactive
  • Simplest case: my code -> a string
  • Length defined case: my code,20 -> a string 20 chars length
  • Double case: cost,15,java.lang.Double (also Integer or Long)
  • Date case: when,10,java.util.Date
  • Boolean case: approved,1,java.lang.Boolean
    (a checkbox will be used for data entry)
  • Twproject object case: customer referral,25,com.twproject.resource.Person -> a Person
  • see this task,25,com.twproject.task.Task -> a Task
  • attachment,15,org.jblooming.ontology.PersistentFile -> an uploaded file

Fixed values

  • A fixed code-value list displayed as radios:
    genre,6,{values:{"m":"male","f":"female"}}
  • A fixed code-value list displayed as combo:
    genre,6,{values:{"m":"male","f":"female"} ,displayAsCombo:true}
Using DB table (both internal to Twproject or external)
 lookup on field,25,{ query:{ ... },connection:{...} }
  • simple case:
    query:{ tableName:"olpl_operator", idColumnName:"id", descriptionColumnName:"loginname" }
  • complete case (more flexible)
    query: {
      select:"select id,name,surname from olpl_operator",
      whereForFiltering:"where name like ? order by name,surname",
      whereForId:"where id=?"
      }
    

 

  • specify an external connection (if not specified Twproject db will be used):
    connection:{
      driver:"com.mysql.jdbc.Driver",
      url:"jdbc:mysql://[YOUR SERVER]/[YOUR DB]",
      user:"[YOUR USER]",
      password:"[YOUR PASSWORD]"
    }
    

 

Required fields: add “,required” at the end of the field definition

  • A generic text field: my code,required
  • Date required case: when,10,java.util.Date,required
  • A lookup: lookup on field,25,{ query:{ ... },connection:{...} },required

Tree structured objects (e.g.: Task or Resource):

  • Add a field on root level only: add my code,20,...,rootOnly
  • Add a field on child level only: add my code,20,...,childOnly

If you want to internationalize the field, just create a label with the name of the field.
E.G. if you need a “street” field, insert on the custom field “street,25” and the go to
admin->labels and create a new label called “street” and insert “street” for English, “rue” for French, “via” for Italian and so on.