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

a before business rule on project task



if(current.parent!='')


{


current.u_ref_proj=current.parent;


}


-Anurag

It is not working. I see the field empty and it is not filling the current project... When i click new project task, I should write manually the project.


What could be missing? WHEN and ACTION are empty. I just added the in the advance tab the code.


When - Before


Insert/update both


-Anurag

It works.


The BR is right.



But what can I do for the already created project tasks... I mean, before this rule. It works only in insert || update record, right?



Thanks a lot,


Skender


I think the only way is to update them all, one by one...