How to give project_user (role) user access to write in projects tasks where he/she is the PM of the parent project?

skendy
Tera Expert

Hi,

I have been thinking how to let users with project_user role to have write acl on the table pm_project_task ONLY if he is the project_manager (field) of the parent project (pm_project).

I grant write to the role with a condition where (dot walking) .u_ref_proj.project_manager is (dynamic) me, but then all project tasks fields become Read Only.

u_ref_proj is a project task field which references to project table.

I have been trying to add the following script (suggested by other in the community) instead of the control but nothing changes:

It is weird because I applied the same script for omitting the New button (thanks to Anurag) from the list and it worked (changing the true/false for the answer)...

var utente=gs.getUserID();

if (parent.project_manager==utente)             //since we have a relationship/related list between the two tables

      answer=true;

else

      answer=false;

I would appreciate any comment!

Thanks,

Skender

1 ACCEPTED SOLUTION

just write the code that when a new task is added , the project number is filled in u_ref_proj.


And on the projet form use the "-> parent" related list.


This will fix all your troubles.


-Anurag

View solution in original post

19 REPLIES 19

Relationship using parent: - this is oob and this is the one that you should use o the form as it makes logical sense also (parent - child) and many oob code and dependencies also runs on the same relationship .


Downside of this is when you have to dotwalk on the parent's fields you can only have the fields that are present on the task table as "parent" is a field of task table. This is why you had to create the new custom reference field, to access the project table's fields.



Now you are also seeing another related list present in the system, don't get confused as this is one of the ways by which we create relationships in SN.






Use the parent one, related list,a nd write code to populate u_ref_proj yourself


-Anurag

Thank you very much Anurag for the explanation. As usual!



Just to be clear:


- what do I have to do once I have created the custom field in pm_project_task which refers to pm_project (what do you mean 'populate it' - should it be a copy of the primary project field)?


- should I create e new relationship between the two tables?


- I ask because I see now two related lists in the project form, but only the one with '-> parent' shows the existing project tasks (should I copy to the other related list the existing tasks by choosing them through Edit button?).


-should I try the condition acl script after these steps?



I know it is not easy, but I feel I am near the complete solution and with no more doubts about these kind of implementations.




Thanks again,


Skender


I am close to the solution.


If I put the referred project in that field i created in each project task (in the new related list), I see the same project task.



What should I do o have that field (u_ref_proj) autocompleted with the names of the referred projects?



Skender


just write the code that when a new task is added , the project number is filled in u_ref_proj.


And on the projet form use the "-> parent" related list.


This will fix all your troubles.


-Anurag

Ok that's the related list I'm using, but where do I write the code? In the dictionary of the field (u_ref_proj)?


Sorry, but I do not know exactly what...