cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple workflow variables in custom form

sergeolyva
Champ in-the-making
Champ in-the-making
Hi all,
  what I want to do is to add custom form with couple of fields, depending on each other. So, I've made custom FormType and custom renderer, from renderer I receive json string that converted to object. The question is how to set multiple workflow variables from FormType? And even, if I'm going into to right direction? Thank's in advance!
Here's custom form type:

public class TopicSpeakerFormType extends AbstractFormType {   
   
        public static final String TYPE_NAME = "speaker";   
   public String getName() {
      return TYPE_NAME;
   }

   @Override
   public Object convertFormValueToModelValue(String propertyValue) {
      Gson gson = new Gson();
      TopicSpeakersSelected data = gson.fromJson(propertyValue, TopicSpeakersSelected.class);
      
      //ProcessEngines.getDefaultProcessEngine().   set data to workflow here?
      
      return data.getTopic().getId();
   }

   @Override
   public String convertModelValueToFormValue(Object modelValue) {
      if (modelValue == null) {
         return null;
      }
      return modelValue.toString();
   }

And here is bean:

public class TopicSpeakersSelected {
   private Topic topic;
   private Set<Speaker> speakers;
   
   public Topic getTopic() {
      return topic;
   }
   public void setTopic(Topic topic) {
      this.topic = topic;
   }
   public Set<Speaker> getSpeakers() {
      return speakers;
   }
   public void setSpeakers(Set<Speaker> speakers) {
      this.speakers = speakers;
   }
}
2 REPLIES 2

sergeolyva
Champ in-the-making
Champ in-the-making
As I understood, I can have whole TopicSpeakersSelected bean as variable.
but when I try to return whole bean, I receive
org.activiti.engine.ActivitiException: couldn't find a variable type that is able to serialize
does that mean that I have to have custom serializer/deserializer?

jbarrez
Star Contributor
Star Contributor
It means your bean must implement Serializable