1

I am able to start workflow of bundle using CoreService in .Net with the below code:

StartWorkflowInstructionData startWorkflowInstruction = new StartWorkflowInstructionData();
            startWorkflowInstruction.Assignee = new LinkToTrusteeData { IdRef = _CoreServiceClient.GetCurrentUser().Id };
            startWorkflowInstruction.ActivityTitle = "A title for the activity";
            startWorkflowInstruction.ProcessInstanceTitle = "A title for the process instance";
            startWorkflowInstruction.Subjects = new[] { new LinkToIdentifiableObjectData { IdRef = bundle.Id } };
            startWorkflowInstruction.ToString();
            _CoreServiceClient.StartWorkflow("tcm:0-222-1", startWorkflowInstruction, new ReadOptions());

But not able to start workflow when doing in similar way in Java. Instead it starts the new process instance. Any idea?

VirtualFolderData bundle = (VirtualFolderData) client.read(tcmid, null);
        StartWorkflowInstructionData instruction = new StartWorkflowInstructionData();
        LinkToTrusteeData trustee = new LinkToTrusteeData();
        trustee.setIdRef(client.getCurrentUser().getId());
        LinkToIdentifiableObjectData obj = new LinkToIdentifiableObjectData();
        obj.setIdRef(bundle.getId());       
        ArrayOfLinkToIdentifiableObjectData arr = new ArrayOfLinkToIdentifiableObjectData( );
        arr.getLinkToIdentifiableObjectData().add(obj);
        JAXBElement<ArrayOfLinkToIdentifiableObjectData> jaxbElement = new JAXBElement<ArrayOfLinkToIdentifiableObjectData>(
                new QName("ns3:ArrayOfLinkToIdentifiableObjectData"), ArrayOfLinkToIdentifiableObjectData.class,
                arr);
        JAXBElement<LinkToTrusteeData> jaxbElementAssignee = new JAXBElement<LinkToTrusteeData>(
                new QName("ns3:LinkToTrusteeData"), LinkToTrusteeData.class,
                trustee);
        instruction.setAssignee(jaxbElementAssignee);
        instruction.setActivityTitle(bundle.getTitle());
        instruction.setProcessInstanceTitle(bundle.getTitle());
        instruction.setSubjects(jaxbElement);
        instruction.getSubjects().setValue(arr);
         jaxbObjectToXML(instruction);

        client.startWorkflow("tcm:0-222-1", instruction, new ReadOptions());
  • Process instance is the representation of the active workflow process in Tridion. Both .NET and Java versions of the StartWorkflow() method should return ProcessInstanceData that represent newly created workflow process. Please clarify how the behavior of Java code is different from .NET one. – AntonM 2 days ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.