Project and Portfolio Management Practitioners Forum

Update Project Request Fields via Webservice

Go to solution
Respected Contributor.

Update Project Request Fields via Webservice


I'm trying to update few custom project fields in header section. they are not OOTB fields but user created fields. I'm not able to update them via webservice.

I tried the example in PM but donno if my code is correct not able to udpate Manager field. but able to update Project Manager via 



private void updateProjectPM(final String projectName, final String PM, final String MGR) throws RemoteException {

        // create the update project object
        final UpdateProjectDocument updateProjDoc = UpdateProjectDocument.Factory.newInstance();
        final UpdateProject up = updateProjDoc.addNewUpdateProject();
        final ProjectInputType pit = up.addNewProjectInput();
        // Create projectBean input
        final ProjectType pb = up.addNewProjectBean();

        String[] projMgr = null;
        projMgr = PM.split(";");
//set Project Managers int countPM = new StringTokenizer(" " +PM + " ", ";").countTokens()-1; //System.out.println("count of characters = " + (i+1)); for (int j = 0; j <= countPM; j++){ //System.out.println(projMgr[j]); pb.addProjectManagerUserName(projMgr[j]); } // Set custom field 'Manager' final SimpleField[] field_Mgr = new SimpleField[1]; final SimpleField field_A = SimpleField.Factory.newInstance(); field_A.setToken("REQ.MANAGER"); field_A.setStringValue1Array(new String[] {MGR}); field_Mgr[0] = field_A; System.out.println("System.out.println( : "+field_Mgr[0]); //pb.setSimpleFieldsArray( field_Mgr[0]); System.out.println(pb.getSimpleFieldsArray()); // Calling web service final ProjectServiceStub stub = new ProjectServiceStub(this.ctx, this.WSURL); stub.updateProject(updateProjDoc); }

I also tried to update the field from example given in DM module. It also failed.

Could someone help me if you have updated custom request fields (not OOTB fields) in a project? thanks.

Respected Contributor.

Re: Update Project Request Fields via Webservice

It worked...

again tried to udpate the fields via example given in DM module. it worked like charm.

my mistake was I was trying to do lot of actions in one class file (connecting to DM, PM, RM) modules all in one file and the loop some where failed.

when I tried to do them seperately it worked.