filenet-p8filenetfilenet-process-engine

get workflow malfunction exception with java api


Does anyone know how to get a workflow malfunction error message using the java pe api? I am running the QueueSample java code provided by IBM and it is not clear to me how to do this. Any help would be appreciated!


Solution

  • I found the malfunction error message for my workflow in the VWParticipantHistory.getLogFields() array. I modified the example code from the Developing Applications with IBM FileNet P8 APIs redbook:

    // Create session object and log onto Process Engine
    ...
    // Get the specific work item
    ...
    // Get VWProcess object from work object
    VWProcess process = stepElement.fetchProcess();
    // Get workflow definitions from the VWProcess
    VWWorkflowDefinition workflowDefinition =
    process.fetchWorkflowDefinition(false);
    // Get maps for each workflow definition
    VWMapDefinition[] workflowMaps = workflowDefinition.getMaps();
    
    // Iterate through each map in the workflow Definition
    for (int i = 0; i < workflowMaps.length; i++) {
        // Get map ID and map name for each map definition
        int mapID = workflowMaps[i].getMapId();
        String mapName = workflowMaps[i].getName();
        // Get workflow history information for each map
        VWWorkflowHistory workflowHistory = process.fetchWorkflowHistory(mapID);
        String workflowOriginator = workflowHistory.getOriginator();
    
        // Iterate through each item in the Workflow History
        while (workflowHistory.hasNext()) {
            // Get step history objects for each workflow history
            VWStepHistory stepHistory = workflowHistory.next();
            String stepName = stepHistory.getStepName();
            System.out.println("step history name = " + stepName);
            // Iterate through each item in the Step History
            while (stepHistory.hasNext()) {
                // Get step occurrence history
                // objects for each step history object
                VWStepOccurrenceHistory stepOccurenceHistory = stepHistory.next();
                Date stepOcurrenceDateReceived = stepOccurenceHistory.getDateReceived();
                Date stepOcurrenceDateCompleted = stepOccurenceHistory.getCompletionDate();
    
                while (stepOccurenceHistory.hasNext()) {
                    // Get step work object information
                    // for each step occurrence
                    VWStepWorkObjectHistory stepWorkObjectHistory = stepOccurenceHistory.next();
                    stepWorkObjectHistory.resetFetch();
                    // Get participant information for each work object
                    while (stepWorkObjectHistory.hasNext()) {
                        VWParticipantHistory participantHistory = stepWorkObjectHistory.next();
    
                        String opName = participantHistory.getOperationName();
                        System.out.println("operation name = " + opName);
                        Date participantDateReceived = participantHistory.getDateReceived();
                        String participantComments = participantHistory.getComments();
                        String participantUser = participantHistory.getUserName();
                        String participantName = participantHistory.getParticipantName();
    
                        VWDataField[] logFields = participantHistory.getLogFields();
                        System.out.println("** start get log fields **");
                        for (int index=0; index<logFields.length; index++){
                            VWDataField dataField = logFields[index];  
                            String name = dataField.getName();
                            String val = dataField.getStringValue();
                            System.out.println("name = " + name + " , value = " + val);
                        }
                        System.out.println("** end get log fields **");
                    } // while stepWorkObjectHistory
                } // while stepOccurenceHistory
            } // while stepHistory
        } // while workflowHistory
    } // for workflow maps