title: How to use custom variables in an Activiti task
body: <p><strong>Problem</strong></p>
  
  <p>I have several Activiti task types, the base types are <code>ServiceTask</code> and <code>UserTask</code>.</p>
  
  <p>Some <code>ServiceTask</code> types are Java implementations, each of them different. Then there are others.</p>
  
  <p>I'd like to distinguish them in my code.</p>
  
  <p><strong>Question</strong></p>
  
  <p>Is it possible to store some custom attributes / properties in the tasks and if so, how?</p>
  
  <p>Example:
  A <code>ServiceTask</code> that implements simple Logging functionality should have a property "TYPE" with the value "LOGGING" which I can then query later.</p>
  
  <p>I tried using <code>FieldExtension</code>, but when I run the workflow, Activiti throws the error:</p>
  
  <pre><code>org.activiti.engine.ActivitiIllegalArgumentException: Field definition uses unexisting field 'TYPE'
  </code></pre>
  
  <p>Same happens for <code>CustomProperty</code>.</p>
  
  <p>Of course I could solve that by declaring the field in the Java class, but I need a solution that works also for non Java service tasks and for user tasks. Or better yet if possible for all flow elements.</p>
  
  <p>Thank you very much!</p>