To create a new forum topic related to Joget Workflow plugins, please click on "Add > Page" located on the top right corner.

18 Comments

  1. Email Plugin

    Hi, 

    I just tried to use email plugin with Joget v2, after designing and testing the workflow then I started to map activities and using email plugin to distribute email.

    Default parameter for email plugin already configured, configuration already tested with outlook and its work fine, but somehow the plugin never send out the emails.

    Is there any way to trace/troubleshoot email plugin process to see why is not sending out emails? I use Avast antivirus and not found *yet* any conflict between Java Runtime and Avast.

    Any help will be very appreciated.

    Rgds,

    Prihadi R.

    1. When the Email Plugin is executed, useful debugging messages will be printed in the console. Could you please share the messages that you're getting? It should tell whether an email is sent from the Java process, or whether there's any error sending out the email.

      1. I just tried another site with java and the java console popup automatically. When I tried the workflow its seems Joget never launch the email plugin but the monitor shown that it passed the step/action where email plugin mapped.

        Any clue why?

        Rgds,

        Pri

        1. Hi,

          The messages are printed in the Tomcat console (assuming you're running Tomcat) or log files in the server running Joget, not the Java Console in the browser. Do you have access to that?

          1. Hi Julian,

            Yes I have access to the server, just logged in and try to see logs file (catalina files, isn't it?) but can find any error, there is may information but don't know which one I need :(

          2. Julian,

            I got this in tomcat console, it said failed to create bean:

            "INFO  25 Aug 2010 17:54:14 org.joget.commons.util.SetupManager  - Using base directory: /root/wflow/

            INFO  25 Aug 2010 17:54:14 org.joget.commons.util.DynamicDataSource  - datasourceName=workflow, url=jdbc:mysql://localhost:3306/wflowdb?useOldUTF8Behavior=true&useUnicode=true&characterEncoding=UTF-8, user=root

            ERROR 25 Aug 2010 17:54:15 org.hibernate.util.JDBCExceptionReporter  - Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: NO))

            ERROR 25 Aug 2010 17:54:15 org.springframework.web.context.ContextLoader  - Context initialization failed

            org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'setupSessionFactory' defined in class path resource [commonsApplicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Hibernate Dialect must be explicitly set

                    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1336)

                    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:471)

                    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1Aug 25, 2010 5:54:15 PM org.apache.catalina.core.StandardContext listenerStart

            "

            what happend? :(

            INFO  25 Aug 2010 17:54:14 org.joget.commons.util.SetupManager  - Using base directory: /root/wflow/
            INFO  25 Aug 2010 17:54:14 org.joget.commons.util.DynamicDataSource  - datasourceName=workflow, url=jdbc:mysql://localhost:3306/wflowdb?useOldUTF8Behavior=true&useUnicode=true&characterEncoding=UTF-8, user=root
            ERROR 25 Aug 2010 17:54:15 org.hibernate.util.JDBCExceptionReporter  - Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: NO))
            ERROR 25 Aug 2010 17:54:15 org.springframework.web.context.ContextLoader  - Context initialization failed
            org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'setupSessionFactory' defined in class path resource [commonsApplicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Hibernate Dialect must be explicitly set
                    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1336)
                    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:471)
                    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1Aug 25, 2010 5:54:15 PM org.apache.catalina.core.StandardContext listenerStart

          3. Julian,

            This is to update that the problem already solved, here is the detail:

            1. After looking from tomcat log (catalina.out) that shown access denied for 'root'@localhost to access MySQL DB, I googling around and found the fix it to do the following

            - Stop MySQL Service (/etc/init.d/mysqld stop)

            - Run mysqld with --skip-grant-tables (need to modify /etc/my.cnf file to add this parameter under [mysqld] section)

            - Start MySQL Service (/etc/init.d/mysqld start)

            - Execute following command

              # mysql -u root mysql 
              mysql> UPDATE user SET Password=PASSWORD('your_new_password') where USER='root'; 
              mysql> FLUSH PRIVILEGES;

              mysql>exit

            - Stop MySQL Service (/etc/init.d/mysqld stop)

            - Run mysqld WITHOUT --skip-grant-tables (need to delete it from /etc/my.cnf file to add this parameter under [mysqld] section)

            - Start MySQL Service (/etc/init.d/mysqld start)

            after that everythine is working fine :D

            sampel of catalina.out that shown eMail pluggin is working fine:

            INFO  27 Aug 2010 14:44:14 org.joget.workflow.shark.WorkflowAssignmentManager  - [processId=304_pkgSansaine_Cuti, processDefId=pkgSansaine#11#Cuti, participantId=PemohonCuti, next user=[admin]]
            INFO  27 Aug 2010 14:44:28 org.joget.workflow.shark.WorkflowAssignmentManager  - [processId=304_pkgSansaine_Cuti, processDefId=pkgSansaine#11#Cuti, participantId=ApprovalCuti, next user=[admin]]
            INFO  27 Aug 2010 14:44:28 org.joget.workflow.controller.WorkflowJsonController  - Assignment 516_304_pkgSansaine_Cuti_PermohonanCuti completed
            INFO  27 Aug 2010 14:44:40 org.joget.workflow.controller.WorkflowJsonController  - VARIABLE: status = OK
            INFO  27 Aug 2010 14:44:40 org.joget.workflow.shark.WorkflowToolActivityHandler  - Executing tool [pluginName=org.joget.plugin.email.EmailPlugin, processId=pkgSansaine#11#Cuti, version= 11, activityId=emailAdministrasi]
            INFO  27 Aug 2010 14:44:14 org.joget.workflow.shark.WorkflowAssignmentManager  - [processId=304_pkgSansaine_Cuti, processDefId=pkgSansaine#11#Cuti, participantId=PemohonCuti, next user=[admin]]

            INFO  27 Aug 2010 14:44:28 org.joget.workflow.shark.WorkflowAssignmentManager  - [processId=304_pkgSansaine_Cuti, processDefId=pkgSansaine#11#Cuti, participantId=ApprovalCuti, next user=[admin]]

            INFO  27 Aug 2010 14:44:28 org.joget.workflow.controller.WorkflowJsonController  - Assignment 516_304_pkgSansaine_Cuti_PermohonanCuti completed

            INFO  27 Aug 2010 14:44:40 org.joget.workflow.controller.WorkflowJsonController  - VARIABLE: status = OK

            INFO  27 Aug 2010 14:44:40 org.joget.workflow.shark.WorkflowToolActivityHandler  - Executing tool [pluginName=org.joget.plugin.email.EmailPlugin, processId=pkgSansaine#11#Cuti, version= 11, activityId=emailAdministrasi]

            INFO  27 Aug 2010 14:44:40 org.joget.workflow.controller.WorkflowJsonController  - Assignment 517_304_pkgSansaine_Cuti_ApprovalCuti completed
            INFO  27 Aug 2010 14:44:40 org.joget.plugin.email.EmailPlugin$1  - EmailPlugin: Sending email completed for subject=DISETUJUI: Permohonan Cuti

            Thanks for the info that inspired me :D

            Rgds,
            Prihadi R

  2. I have a custom ApplicationPlugin that I have executing prior to showing a form in my workflow.  I am  using the plugin to pre-populate the form. If I have a form in my process called Form1 that has a data table called Table1, how do I update the form variables from my plugin?

  3. Yes. I am trying to do exactly the same thing. I have a custom version of the json plugin. I can

    make the json call and get back the results then I call

    Form form =

    formManager.loadDynamicFormByProcessId(formDataTable, wfAssignment.getProcessId());

    and I get back a null form. I assume it must work since this is what the json plugin does.

    the form class has the ability to return a list of custom fields also that I want to populate with

    the json data.

    still can't figure out why form is null. I noticed there is a way to go to dao to create a record in the

    form but not sure if that is proper way to handle it.

    Thanx

    Fred

  4. About Plugin Participant Mapping... Could you post a sample?

    Tks

    dex

    1. Plugin (Tool) must be placed within a participant of "system" type. So, there's no need to perform participant mapping on system participant. You may refer to http://java.dzone.com/articles/prototyping-workflow-driven, Figure 1.7 for a sample screenshot

      1. I refer to Participants Plugin, when I am mapping a participant to package level.

        1. Mapping to a Participant Plugin allows us to programmatically determine the user(s) acting on this participant. So, if you map a participant to BeanShell Plugin, then we can use scripting (which is essentially using Java syntax) to return a list of users, identified by username.

          Example:

          import java.util.*;
          
          // some logic to determine users
          
          // return usernames in a Collection
          Collection users = new ArrayList();
          users.add("clark");
          users.add("cat");
          return users;
          1. hi mr tiensoon,

            how about if i want to set multiple participants based on previous form (using workflow variables)?

            i think i can use this beanshell plugin just like your example above..

            but i confuse when i try to read previous form variables (workflow variables)

            can you give some code example to solve this problem ?

            thanks :-)

            1. Hi Abdullah,

              When the multiple values selected from checkbox is set to a workflow variable, the workflow variable value will be set as something like "username1|username2" (without quotation marks).

              Using BeanShell Plugin, you would be able to access the workflow variable value, using Hash Variable, such as:

              String usernames = "#variable.assignees#"; // in this example, usernames would be username1|username2

              Then in the BeanShell script, you can use java.util.StringTokenizer to split "username1|username2" into "username1" and "username2". And subsequently set the individual username to a Collection object

              1. Hallo Mr. Tiensoon, this is my java code : 

                import java.util.*;
                Collection list = new ArrayList();
                String usernames = "#variable.abc#";
                String delimeter = "|";
                StringTokenizer str = new StringTokenizer(usernames, delimeter);
                while(str.hasMoreTokens()){
                	String temp = str.nextToken();
                	//System.out.println(temp);
                	list.add(temp);
                }
                return list;
                

                I used this code to map multiple participant like you've suggested before.

                My workflow design and the result can be seen below




                And it still failed (by the value of 'List of Pending' above).

                Any mistakes that I made? How can I solve my problem? 

                Thanks for your help. :)

                1. Hi Dolot,

                  Sorry, I've forgotten that the BeanShell Plugin has limitation using some Hash Variables, when BeanShell is used as Participant Plugin.

                  Please try using Java API to get the workflow variable value. I have modified your codes to this:

                  import java.util.*;
                  import org.joget.workflow.model.service.*;
                  
                  Collection list = new ArrayList();
                  WorkflowManager workflowManager = (WorkflowManager) pluginManager.getBean("workflowManager");
                  String usernames = workflowManager.getProcessVariable(workflowActivity.getProcessId(), "abc"); // get workflow variable value using Java API
                  
                  String delimeter = "|";
                  StringTokenizer str = new StringTokenizer(usernames, delimeter);
                  while(str.hasMoreTokens()){
                  	String temp = str.nextToken();
                  	//System.out.println(temp);
                  	list.add(temp);
                  }
                  return list;
                  1. Hi Tiensoon, 

                    I am trying to use this code, but keep getting the below error.

                    Attempt to resolve method: getProcessId() on undefined variable or class name: workflowActivity : at Line: 6 : in file: inline evaluation of: ``import java.util.; import org.joget.workflow.model.service.;  Collection list  . . . '' : workflowActivity .getProcessId ( ) 

                    Looks like I need to declare workflowActivity object before I can use it. Please help.
                    Attempt to resolve method: getProcessId() on undefined variable or class name: workflowActivity : at Line: 6 : in file: inline evaluation of: ``import java.util.; import org.joget.workflow.model.service.;  Collection list  . . . '' : workflowActivity .getProcessId ( )