It's all about the answers!

Ask a question

How to make a parent work item invalid when all child workitems are invalid state by using server api?


Pavan M (393) | asked Feb 12 '20, 9:02 a.m.

I had created child workitems and make them as invalid but when I am trying to invalid the parent workitem. in console it is showing that the parent workitem state had set to Invalid but in the web it remains in inprogress state only and along with that it is throwing error "An unhandled exception occurred during "InvalidateParent11".

'Save Work Item' failed.". Can any one suggest for rectifing that error. Check the below code for reference.
-------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------
newState= (IWorkItem)fworkItemServer.getAuditableCommon().resolveAuditable(newState ,IWorkItem.FULL_PROFILE,monitor).getWorkingCopy();
                        IWorkflowInfo iWorkflowInfo2 = fworkItemCommon.findWorkflowInfo(newState, monitor);
                        System.out.println("Entered inside");
                        Identifier<IState>[] availableActions = iWorkflowInfo2.getAllStateIds();
                     
                        for (Identifier<IState> stateIds : availableActions) {
                           
                          
                            System.out.println("State is : " + iWorkflowInfo2.getStateName(stateIds));
                          
                            if (iWorkflowInfo2.getStateName(stateIds).equalsIgnoreCase(Done_State)) {
                              
                                newState.setState2(stateIds);
                                System.out.println("Updated State is : "+iWorkflowInfo2.getStateName(newState.getState2()));
                             
                              
                                System.out.println("State is : " + iWorkflowInfo2.getStateName(newState.getState2()));
                             
                              
                              
                                System.out.println("stage6");
                                stateIds.getType();
                                System.out.println("stage7");
                                Set<String> additionalParams = new

                                HashSet<String>();
                                System.out.println("stage8");
                                additionalParams.add("SavedChild");
                                System.out.println("stage9");
                                newState = (IWorkItem) newState.getWorkingCopy();
                                System.out.println("stage10");
                                IStatus saveStatus =

                                        fworkItemServer.saveWorkItem3(newState, null, null, additionalParams);


Thanks







Be the first one to answer this question!


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.