Project view for Sub WBS Elements

Hello Community,

I am trying to customize the Project item view to be able to view sub WBS elements as separate projects so that Project Managers at different levels can view and interact with the schedule of their own project without having to view or modify the other WBS Elements. While also enabling the Program manager to have a complete view including interdependencies of activities between multiple projects.

I expected Program item to do this, but it doesn't really do anything as far as I know.

Anyway, I was able to achieve what I set out to do(sort of) in a couple of different ways but I am faced with multiple issues.

Case 1: I tried replacing the property wbs_id of a project with a Sub WBS Element of a different project, the view is generated as expected.

Case 2: I create project items for each Sub WBS Element I expect to have and then add them to the Sub WBS relationship of the a program level WBS Element. Again, the view is generated as expected.

In both cases I'm not really respecting the property "is_top" of the WBS Element, I haven't found it really being used anywhere.

But in both cases, whenever I try to edit any of the project items I get the error : "WBS Activity2 already exists" or "Sub WBS already exists."

Error details:

 <af:legacy_detail>WBS Activity2 already exists.</af:legacy_detail>
 <af:legacy_faultstring>Violation of PRIMARY KEY constraint.</af:legacy_faultstring>
 

I tried to fix this by changing the "action" attribute from 'add' to 'create' of the relationship item xml elements inside the AML generated inside the method Project_saveProjectTree(This server method updates all the items whenever a change is made in the project view.)

This seems to have fixed the issue in some scenarios, and it lets me edit the lower tier project items as intended.

However in some other cases, such as when I edit a program level project item I get the error:

"Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. The statement has been terminated. Warning: Null value is eliminated by an aggregate or other SET operation. Warning: Null value is eliminated by an aggregate or other SET operation. ..."

The last sentence repeats about 17 times. The error details don't provide any additional information.

The perplexing part about the issue is that I DO NOT get this error when I extract the AML query that is generated inside the method Project_saveProjectTree, and then submit it through Nash or Innovator Admin. It only fails inside the method.

So, I'm not quite sure why this is happening or if my approach is wrong from the beginning.

Any inputs on the issues or a better way to achieve what I want to do with respect to the project item are appreciated.

Thanks in advance,

-Prasanth