Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
1 reply Latest Post - ‏2013-08-13T01:49:25Z by KaranBal
RamnishJaiswal
RamnishJaiswal
2 Posts
ACCEPTED ANSWER

Pinned topic Workflow Issue for Automated Step

‏2013-08-01T07:36:39Z |

 

I am trying to execute automated step through Java code. I have written logic to set several exit values & based on that value the flow will go to next step.

The problem I am facing that, the exit values are setting as per logic but it is stucked on that automated step and not moving to next step. I have written my logic in out(WorkflowStepFunctionArguments inArgs) method. After that I have moved my code in timeout(WorkflowStepFunctionArguments inArgs) method, using that it is moving to next method randomely not as per the logic.

Kindly suggest the solution.

Steps:

Step 1: OrApproval

Step 2: Go to three parellal steps after approval

Step 3: Merge Step

Step 4: Go to decider step. It is automated step having several exit values and based on that respectve next steps.

Code:

 

public voidtimeout(WorkflowStepFunctionArguments inArgs) {

 

try {

 

PIMCollection<CollaborationItem> collaborationItems = inArgs

.getItems();

ExitValue exitValue;

WorkflowStep workflowStep = inArgs.getCollaborationStep()

.getWorkflowStep();

--------  str =  some logic to set exit value.....

exitValue = workflowStep.getExitValue(str

.trim());

 

if (exitValue == null)

exitValue = workflowStep

.createExitValue(str.trim());

 

Logger.logDebug("..Exit Value..:"

+ exitValue.toString());

 

inArgs.getTransitionConfiguration()

.setExitValue(caItem, exitValue);

}

} catch (Exception e) {

Logger.logDebug("..Exception occured in NPI workflow step processing for Rejection.."

+ e.toString());

} catch (Error e) {

Logger.logDebug("..Error occured in NPI workflow step processing for Rejection.."

+ e.toString());

} finally {

 

if (ctx != null) {

ctx.commit();

ctx.cleanUp();

}

 

}

 

}

 

 

 

........

 

 

 

  • KaranBal
    KaranBal
    108 Posts
    ACCEPTED ANSWER

    Re: Workflow Issue for Automated Step

    ‏2013-08-13T01:49:25Z  in response to RamnishJaiswal

    You can use the getEntryMergeState operation to get the state of the item in the merge step. If the stuck item returns 3, then the item is truly stuck in the merge step. If it returns a value less than 3, then it is just waiting for the previous split entries to show up.

    IC Link: http://pic.dhe.ibm.com/infocenter/mdm/v10r1/topic/com.ibm.pim.sop.doc/scripts/collaboration_area/pim_ref_scr_cla_getEntryMergeState.html


    If it is truly stuck, then the question on why it is stuck is harder to answer. Regardless of whether the values are properly updated or not, an item should never be stuck on an automated step unless there is an error. So check for the error. If there is no error, then try to detect a pattern as to what triggers these values to be stuck; bad data, corruption, validation errors, missing attributes etc.

    You may use the following script to move the stuck item to the next step (it will check to see if getEntryMergeState is 3 and if it is, then it will move it to the next step):
    ---------------------------------------------------------------
    var oColArea = getColAreaByName(sColAreaName);
    var oEntrySet = oColArea.getEntriesInStep(sStepPath);
    out.writeln("EntrySet size: " + oEntrySet.getEntrySetSize());
    var iCount = 1;
    forEachEntrySetElement(oEntrySet, oEntry)
    {
        if(null != oEntry)
        {
            var iEntryMergeState = oColArea.getEntryMergeState(oEntry, sStepPath);
            out.writeln("INFO:: Merge state for Entry PK ["+oEntry.getEntryAttrib(sAttribPath)+"] is: "+ iEntryMergeState);
           if( null != iEntryMergeState && iEntryMergeState == 3)
            {
                hmResult = oColArea.moveEntryToNextStep(oEntry, sStepPath, sStepAction);
                if(null != hmResult && hmResult.size() > 0)
                {
                    out.writeln("ERROR:: Result of moveEntryToNextStep() call: "+hmResult);
                }
            }
        }
        else
        {
            out.writeln("WARN:: ***NULL value counter: "+iCount++);
        }
    }