AnsweredAssumed Answered

Custom email selector form property - having issues understanding default data

Question asked by ericsnyder on May 9, 2013
Latest reply on May 14, 2013 by frederikheremans1
I am developing custom form property that is an email selector using a TwinColSelect. The heart of my issue is that I don't understand how to handle the data for the TwinColSelect. I need to prepopulate the property with some email addresses and then allow users to add their own as well. I will also need to get the email addresses selected in later email tasks to send the emails to these addresses.

I have created the custom form property and successfully used it in Explorer. I have learned how to prepopulate the values using the examples from the book and even learned how to preselect values. My two questions are:

1) How do I use the form values in the form definition (ID and Name) to populate the TwinColSelect. Mainly, how do I access the values I have predefined in the process definition?

2) Later, when the user selects their own choices what do I use to access these choices in an email task?

My property renderer (I know, the code is really ugly right now):
   public Field getPropertyField(FormProperty formProperty) {
      final TwinColSelect select = new TwinColSelect("Send status emails to:");
      Object formValues = formProperty.getType().getInformation("values");
         // Put some data in the select
         String emailList[] = {"Email one", "Email two", "Email three"};
         for (int i=0; i<emailList.length; i++)

         //Set various list properties
         select.setRightColumnCaption("Going to…");

          // Preselect a few items
         //Remove the first and last character
         String temp = formProperty.getValue();
         if (temp != null){
            temp = formProperty.getValue().substring(1);
            temp = temp.substring(0, temp.length() - 1);
            int numberOfEmails = StringUtils.countMatches(temp, ", ") + 1;
            String[] emailData = new String[numberOfEmails];
            if (numberOfEmails > 1){
               emailData = temp.split(", ");
               emailData[0] = temp;

            //Be sure new added items make it in the list
            for (int i=0; i<emailData.length; i++){
            HashSet<String> preselected = new HashSet<String>();
            Collections.addAll(preselected, emailData);
         return select;

The task definition with the emailChecklist property defined:

    <userTask id="usertask1" name="First task" activiti:assignee="erics">
        <activiti:formProperty id="desc" name="Decsription" type="textArea"></activiti:formProperty>
        <activiti:formProperty id="emails" name="Emails" type="emailChecklist">
          <activiti:value id="Testing1" name="Testing1"></activiti:value>
          <activiti:value id="Testing2" name="Testing2"></activiti:value>