AnsweredAssumed Answered

Multiple workflow variables in custom form

Question asked by sergeolyva on Mar 3, 2014
Latest reply on Mar 10, 2014 by jbarrez
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;
   }
}

Outcomes