1
0
-1

I use two ways listed below to try to get workflow variable by beanshell in participant of workflow, but all two failed, would you please give some ideas about how to solve this issue.

import org.joget.workflow.model.WorkflowActivity;
import org.joget.apps.app.service.AppUtil;
import org.joget.workflow.model.service.*;
  
//way 1
    WorkflowManager wm = (WorkflowManager) pluginManager.getBean("workflowManager");
    wm.activityVariable(workflowAssignment.getActivityId(), "status", "variableValue");
 
//way 2
    String status= "#variable.status#";
 
    System.out.print("===status===" + status);
INFO  29 Jun 2015 10:51:53 org.joget.workflow.shark.WorkflowAssignmentManager  - [processId=19_crm_process1, processDefId=crm#1#process1, participantId=approver, next user=[admin]]
ERROR 29 Jun 2015 10:51:53 org.joget.apps.form.lib.BeanShellFormBinder  - Error executing script
Sourced file: inline evaluation of: ``import java.sql.*; import java.util.Collection; import java.util.ArrayList; impo . . . '' : Typed variable declaration : Attempt to resolve method: getBean() on undefined variable or class name: pluginManager : at Line: 9 : in file: inline evaluation of: ``import java.sql.*; import java.util.Collection; import java.util.ArrayList; impo . . . '' : pluginManager .getBean ( "workflowManager" ) 
	at bsh.UtilEvalError.toEvalError(Unknown Source)

error message as below for your reference.

error message of way1
ERROR 29 Jun 2015 10:54:49 org.joget.apps.app.lib.BeanShellTool  - Error executing script
Sourced file: inline evaluation of: ``import java.sql.*; import java.util.Collection; import java.util.ArrayList; impo . . . '' : Attempt to resolve method: getActivityId() on undefined variable or class name: workflowAssignment : at Line: 10 : in file: inline evaluation of: ``import java.sql.*; import java.util.Collection; import java.util.ArrayList; impo . . . '' : workflowAssignment .getActivityId ( ) 
	at bsh.UtilEvalError.toEvalError(Unknown Source)
error message of way2
INFO  29 Jun 2015 10:51:53 org.joget.workflow.shark.WorkflowAssignmentManager  - [processId=19_crm_process1, processDefId=crm#1#process1, participantId=approver, next user=[admin]]
ERROR 29 Jun 2015 10:51:53 org.joget.apps.form.lib.BeanShellFormBinder  - Error executing script
Sourced file: inline evaluation of: ``import java.sql.*; import java.util.Collection; import java.util.ArrayList; impo . . . '' : Typed variable declaration : Attempt to resolve method: getBean() on undefined variable or class name: pluginManager : at Line: 9 : in file: inline evaluation of: ``import java.sql.*; import java.util.Collection; import java.util.ArrayList; impo . . . '' : pluginManager .getBean ( "workflowManager" ) 
	at bsh.UtilEvalError.toEvalError(Unknown Source)

 

Thanks
Gene
    CommentAdd your comment...

    1 answer

    1.  
      2
      1
      0

      The error "getBean() on undefined variable or class name: pluginManager" means that there's no such variable pluginManager. You probably need to do a lookup to get it e.g.

       

      import org.joget.apps.app.service.AppUtil;
      import org.joget.plugin.base.PluginManager;
      PluginManager pluginManager = (PluginManager)AppUtil.getApplicationContext().getBean("pluginManager");
       
        CommentAdd your comment...