Regarding print Documentum Workflow status on console

Hello Sir ,

I am new to Documentum , Could you please provide the answers for below questions ?

Below code create the workflow and run it .

IDfWorkflowBuilder workflowBuilder = session.newWorkflowBuilder(process.getObjectId());
workflowBuilder.getWorkflow().setObjectName(wfName);
workflowBuilder.getWorkflow().setSupervisorName(supervisorName);
workflowBuilder.runWorkflow();

Above code run the Workflow.
Now i want to print the workflow status in console like "The Workflow is completed".
How can i get the workflow completed status using DFC programming.

Best Answers

  • Curious, are just planning to do this b/c you want to debug your workflow? If you want to output to the console, then you need to write system.out in a server activity. Alternatively, you can queue up a notification to a user if you want to programmatically notify someone (e.g. workflow supervisor).

  • All your code does is check for the existence of the workflow. If the workflow does NOT exist, that does NOT mean that it has completed. It could have been halted/deleted by sysadmin. Review my previous question on why you are trying to do this.

Answers

  • Curious, are just planning to do this b/c you want to debug your workflow? If you want to output to the console, then you need to write system.out in a server activity. Alternatively, you can queue up a notification to a user if you want to programmatically notify someone (e.g. workflow supervisor).

  • I have wrote below code , to identify either Workflow is Completed or Not .

    Please let me know either below code is correct or not to identify Workflow is Completed or Not.

        _String dql ="SELECT wf.r_object_id as workflowId FROM dm_workflow wf, dmi_workitem i, dmi_package p "
                        + "WHERE i.r_workflow_id = '" + workflowId.getId() + "' and p.r_component_id='" + workflowId.getId() + "'";
        String workflowId = DqlQueryHelper.executeSingleResultQuery(dql, "r_object_id", session);
        if(StringUtils.isEmpty(workflowId)) 
        {
              System.out.println("Workflow completed ");
        }
        else
        {
            System.out.println("Workflow is NOT completed ");
        }_
    
  • All your code does is check for the existence of the workflow. If the workflow does NOT exist, that does NOT mean that it has completed. It could have been halted/deleted by sysadmin. Review my previous question on why you are trying to do this.

  • hi,

    workflowId.getId() only work if workflow is still live. if workflow is completed, this function will not work.

    you need to either write workflowId to some attribute to store it and use this workflow to check whether workflow exist or not.

    other option, is to use dm_audittrail to capture workflowID, and then check whether workflow is still live or not

    Tony

    Tony Qiu
    Opentext ECD - SME

  • Hi hqiu ,

    As you suggest in previous comment like :
    ** "use dm_audittrail to capture workflowID, and then check whether workflow is still live or not".**

    Actually I can't see the table (dm_audittrail) columns due to permission issue.
    So is there any column in the table "dm_audittrail" so based on that i can get the Completed Workflow ID ? or based on column "event_name" we can get complted Workflow ID ?

  • Make sure your user account is configured to View Audit trail. You will also need to first configure your user account to Config Audit trail to audit specific workflow activities.