5 Replies Latest reply on Jul 17, 2012 4:16 PM by Scott Brodersen

    "No payload set" error in CQ5 workflow

    briman33

      I'm trying to programmatically start a workflow from an OSGi service/servlet. Everything seems to work fine, I checked the WorkflowData and the model to verify they are correct. However, when the startWorkflow method runs, it creates a new instance of the workflow, but doesn't set the payload, and i get this in the error.log file:

       

      •      com.day.cq.workflow.impl.jcr.WorkflowManager No payload set
      •      com.day.cq.workflow.impl.CQWorkflowSession Workflow instance started with model: /etc/workflow/models/skill-request/jcr:content/model and  ID: /etc/workflow/instances/2012-07-17/model_2347856755318064 for payload: skill,Software,barmstrong

       

      As far as I can tell, it has the right data, but refuses to set it to the workflow. Any thoughts or hints would be much appreciated.

       

      My code:

       

      protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException

      {

       

           String skillname = request.getParameter("skillname");

           String skilltype = request.getParameter("skilltype");

           String userid = request.getParameter("userid");

       

       

                          // Getting variables ready for a Workflow

       

                          ResourceResolver resourceResolver = null;

                          Session session = null;

       

       

       

                          try {

                                    SlingHttpServletRequest slingReq = (SlingHttpServletRequest) request;

                                    session = slingReq.getResourceResolver().adaptTo(Session.class);

       

                                    WorkflowSession wfSession = _workflowService

                                                        .getWorkflowSession(session);

       

                                    String workflowId = "/etc/workflow/models/skill-request/jcr:content/model";

       

                                    // Starting a Workflow

       

                                    WorkflowModel model = wfSession.getModel(workflowId);

       

                                    WorkflowData wfData = wfSession.newWorkflowData("SKILL_DATA",

                                                        skillname + "," + skilltype + "," + userid);

       

                                    Workflow wf = wfSession.startWorkflow(model, wfData);

       

                          } catch (WorkflowException e) {

                                    ps.println(e.getMessage());

                                    e.printStackTrace(ps);

                          } catch (Throwable e){

                                    ps.println(e.getMessage());

                                    e.printStackTrace(ps);

                          }

      }

        • 1. Re: "No payload set" error in CQ5 workflow
          Scott Brodersen Adobe Employee

          I believe the object used to create the WorkflowData object (i.e. the workflow payload) must either be the path of a repository node, or the UUID of the node, or the serialized object of the node. You can't use the string value directly as you have done. See the Managing Workflow Instances section in http://dev.day.com/docs/en/cq/current/developing/developing_workflows.html

           

          hth

           

          scott

          • 2. Re: "No payload set" error in CQ5 workflow
            briman33 Level 1

            Thanks for the quick response Scott. I tried setting the Object to the path of a repository node:

             

                 WorkflowData wfData = wfSession.newWorkflowData("SKILL_DATA",  pagepath);

             

            but it still failed to set as the workflow's payload. I also tried starting the dialog from the Sidekick, which does work.Here are the log messages for the two runs (Sidekick run first, failing run second):

             

            POST /etc/workflow/instances HTTP/1.1] com.day.cq.workflow.impl.CQWorkflowSession Workflow instance started with model: /etc/workflow/models/skill-request/jcr:content/model and  ID: /etc/workflow/instances/2012-07-17/model_2352496948786228 for payload: /content/icubed_profile_site/index/resources/barmstrong

             

            POST /apps/icubed/skill_request HTTP/1.1] com.day.cq.workflow.impl.CQWorkflowSession Workflow instance started with model: /etc/workflow/models/skill-request/jcr:content/model and  ID: /etc/workflow/instances/2012-07-17/model_2352486082873661 for payload: /content/icubed_profile_site/index/resources/barmstrong

             

            Yet the first run sets the payload just fine, while the second sends back the "No payload set" error.

             

            Brian

            • 3. Re: "No payload set" error in CQ5 workflow
              Sham HC Level 7

              See if setting payload type to JCR_PATH helps 

                   WorkflowData wfData = wfSession.newWorkflowData("JCR_PATH",  pagepath);

              1 person found this helpful
              • 4. Re: "No payload set" error in CQ5 workflow
                briman33 Level 1

                Setting it to "JCR_PATH" worked like a charm, thanks a ton guys.

                 

                I feel like the API documentation ought to be updated to show that neither the String nor the Objectare arbitrary when building the WorkflowData object. Unless it is somewhere in there, and I missed it somehow.

                 

                Thanks again!

                 

                Brian

                • 5. Re: "No payload set" error in CQ5 workflow
                  Scott Brodersen Adobe Employee

                  I'm glad you got it working, Brian. I think you are right about the API docs. I'll log a bug so that they get fixed up.

                   

                  scott