4

I used the link how to start workflow for bundle using core service? and wrote the below code.

private bool StartWorkflow(VirtualFolderData bundledata, out string processInstanceID)
    {
        bool isStarted = false;
        processInstanceID = string.Empty;
        try
        {
            string processdefID = GetContextualProcessDefinitionIDByName(objClient, "Publish Bundle Workflow", bundledata.LocationInfo.ContextRepository.Title);
            StartWorkflowInstructionData workflowInstruction = new StartWorkflowInstructionData() { ProcessInstanceTitle = "Publishing the Bundle " + bundledata.Title};                
            workflowInstruction.Subjects = new[] { new LinkToIdentifiableObjectData() { IdRef = bundledata.Id } };
            workflowInstruction.ProcessDefinition = new LinkToProcessDefinitionData() { IdRef = processdefID };
            ProcessInstanceData pid = (ProcessInstanceData)objClient.StartWorkflow(bundledata.LocationInfo.ContextRepository.IdRef, workflowInstruction, new ReadOptions());
            processInstanceID = pid.Id;
            Log(FormatDate() + "Publish Bundle Workflow process has been initiated!!!!!! Title - " + pid.Title);
            if (!string.IsNullOrEmpty(pid.Id)) isStarted = true;
        }
        catch (Exception ex)
        {
            Log(FormatDate() + "Exception during Starting the workflow with message : " + ex.Message);
        }

        return isStarted;
    }

and then based on the Process Instance ID I'm tring to force finish the workflow process.

string workFlowProcessID = string.Empty;
                                 if (StartWorkflow(bundledata, out workFlowProcessID))
                                 {
                                     Log(FormatDate() + "Bundle has been sent to workflow!!! Process Instance ID - " + workFlowProcessID);
                                     objClient.ForceFinishProcess(workFlowProcessID, liveApprovalStatusID, objReadOptions);
                                     Log(FormatDate() + "Force Finishing the workflow");
                                 }

My process instance is created but there is no bunlde attached to it. And while doing the force finish I'm facing and oracle error.

Exception in Perform Testing() A database error occurred while executing Stored Procedure "TCM_WORKFLOW.ARCHIVE_PROCESS_INSTANCE ". ORA-02292: integrity constraint (TCMDBUSER.FK_WFL_ACT_INST_PROC_INST) violated - child record found ORA-06512: at "TCMDBUSER.TCM_WORKFLOW", line 1023 ORA-06512: at line 1

This isssue is intermittent and sometimes the code works absolutely fine. I can force finish the process manually from CME.

Please advice if I'm missing something.

5
  • Could it be that you're trying to finish a process that includes a new (less than version 1.0) item that has been published?
    – Nuno Linhares
    Apr 6, 2015 at 12:35
  • Yes actually. I'm attaching a newly created page to the bundle but the page is in minor version. Apr 6, 2015 at 13:04
  • 2
    If this new page has been published anywhere, then the workflow cannot finish because that implies cancelling changes. On items with version > 1.0, this is easy: just rollback. On new items this means the item must be deleted. Because it is published, it cannot be deleted... getting you on a catch-22 of Business Rule conflict. The only way around this is to first unpublish the page, then finish the process.
    – Nuno Linhares
    Apr 6, 2015 at 13:06
  • Can you explain the idea behind trying to force finish a workflow immediately after starting it? Is the first activity an automated activity? In that case you may be force fiinishing the workflow while the automated activity is in progress Apr 6, 2015 at 17:00
  • The idea is to create automated test cases using core service to test workflows. I need to end the workflow manually to ensure that the page goes through entire life cycle. And NO the first activity is not automated. @NunoLinhares : I removed all the predefined activities on the page that I was creating and ensured that it is in version 1.0 before I add it to the bundle but still I face the same issue. Apr 7, 2015 at 7:42

1 Answer 1

2

Even though your use/test case is rather extreme, the mentioned error should not occur and hints at a product defect. Consider contacting SDL Customer Support to get it analyzed further.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.