AnsweredAssumed Answered

Problem in getting Bean Object in JavaDelegate

Question asked by sarkar92 on Aug 29, 2012
Latest reply on Aug 30, 2012 by sarkar92
We are using restful api to access Activiti Process as webservices.
We are sending parameters (including objects) to workflow serviceTask.
But when we try to retrieve the object in JavaDelegate using "execution.getVariable("objectName")" ,its return String object byDefault which cannot be cast to specific bean object which it belongs.

the exception —–>

 java.lang.ClassCastException: java.lang.String cannot be cast to net.simplyfiIT.dto.UserBean

here how I send parameters to the workflow——–>

 param.put("processDefinitionId", processDefinitionId);
             param.put("beanObject",user);
             param.put("screenName", screenName);
             param.put("action","Initiate Create User");
             param.put("object", object);
            
         //Call activiti api
            processInstanceId=HandleActivitiProcess.startRequestedProcess(param);
            

here how I get variable in JavaDelegate——>

Object obj =  execution.getVariable("beanObject");  //this is the object
        String scName = (String) execution.getVariable("screenName");

Outcomes