title: Camunda External Task HashMap Dezerialization
body: <p>I am working with Camunda External Tasks, implementing my own handler from ExternalTaskHandler, but when I want to get a variable like this:</p>
  
  <pre><code>HashMap map = externalTask.getVariable("PROCVARS");
  </code></pre>
  
  <p>I had received an error:</p>
  
  <pre><code>org.camunda.bpm.client.exception.ValueMapperException: TASK/CLIENT-01024 Cannot find serializer for value 'rO0ABXNyABFqYXZhLnV0aWwuSGFzaE1hcAUH2sHDFmDRAwACRgAKbG9hZEZhY3RvckkACXRocmVzaG9sZHhwP0AAAAAAAAx3CAAAABAAAAAFdAAabmF0dXJhbF9wYXRlcm5hbF9sYXN0X25hbWV0AARNb3JhdAAPcGVyc29uX2xlZ2FsX2lkdAAFMTIzNDV0AApyZXF1ZXN0X2lkdAABNXQAEm5hdHVyYWxfZmlyc3RfbmFtZXQACUNocmlzdGlhbnQAEXBlcnNvbl9sZWdhbF90eXBldAABQ3g='
  at org.camunda.bpm.client.impl.ExternalTaskClientLogger.valueMapperExceptionDueToSerializerNotFoundForTypedValueField(ExternalTaskClientLogger.java:183) ~[?:?]
  at org.camunda.bpm.client.variable.impl.DefaultValueMappers.findMapperForTypedValueField(DefaultValueMappers.java:78) ~[?:?]
  at org.camunda.bpm.client.variable.impl.VariableValue.getSerializer(VariableValue.java:73) ~[?:?]
  at org.camunda.bpm.client.variable.impl.VariableValue.getTypedValue(VariableValue.java:58) ~[?:?]
  at org.camunda.bpm.client.task.impl.ExternalTaskImpl.getVariableTyped(ExternalTaskImpl.java:271) ~[?:?]
  at org.camunda.bpm.client.task.impl.ExternalTaskImpl.getVariableTyped(ExternalTaskImpl.java:260) ~[?:?]
  at com.fisa.bpm.handler.ScheduleHandler.convertTo(ScheduleHandler.java:40) ~[?:?]
  at com.fisa.bpm.handler.ScheduleHandler.execute(ScheduleHandler.java:26) ~[?:?]
  at org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.handleExternalTask(TopicSubscriptionManager.java:143) ~[?:?]
  at org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.lambda$acquire$0(TopicSubscriptionManager.java:102) ~[?:?]
  at java.util.Arrays$ArrayList.forEach(Arrays.java:3880) ~[?:?]
  </code></pre>
  
  <p>The object was created in the flow bpmn with a script javascript:</p>
  
  <pre><code>var HashMap = Java.type("java.util.HashMap");
  var vars = new HashMap();
  vars.put("request_id",request_id);
  vars.put("person_legal_type","C");
  vars.put("person_legal_id","12345");
  vars.put("natural_paternal_last_name","Mora");
  vars.put("natural_first_name","Christian");
  
  execution.setVariable('PROCVARS', vars);
  </code></pre>
  
  <p>If I check the object on Camunda Cockpit, I see this:</p>
  
  <p><a href="https://i.stack.imgur.com/JIAba.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JIAba.png" alt="Value of PROCVARS - It is a Map"></a></p>
  
  <p>The Camunda BPMN flow is this:</p>
  
  <p><a href="https://i.stack.imgur.com/UOKR4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UOKR4.png" alt="Camunda BPMN"></a></p>
  
  <p>Anyone knows how to deserialize in a External Task implementation this kind of objects?</p>
  
  <p><strong>UPDATED</strong></p>
  
  <p>Works for me, changing in the script task the object to <strong>JSON format</strong>:</p>
  
  <pre><code>var vars = {};
  vars.request_id = request_id;
  vars.person_legal_type = "C";
  vars.person_legal_id = "12345";
  vars.natural_paternal_last_name = "Mora";
  vars.natural_first_name = "Christian";
  
  var proc = JSON.stringify(vars);
  execution.setVariable('PROCVARS', proc); 
  </code></pre>