List Control

sunny13
Giga Expert

Hi All,

I'm trying to hide "Edit" in the change task related list by using advance script in list control   for people without change_manager role and also there is an OR condition with respect to state.

Please review my code,

var answer;

if(gs.hasRole == "change_manager" ) ||   (parent.state=='3' || parent.state=='4' || parent.state=='-2' || parent.state=='-13' || parent.state=='-14' || parent.state=='2' || !parent.active;)

{

  answer=false;

}

else{

  answer=true;

}

But what happens is the EDIT button is not visible to anyone with any role except ADMIN i even revoked all changes but the EDIT button is missing from the related list.

But NEW button is visible to Users

find_real_file.png

Can someone help me debug this issue.

1 ACCEPTED SOLUTION

The change_task table should be editable to the user. Make sure the MPI


Change Manager has write access to the table.


View solution in original post

31 REPLIES 31

As per the condition. The MPI change manager will NOT have access to the


Edit button.



Sent from my iPhone


zica
Giga Guru

As I mentionned above, you want to display the button to somebody with change_manager role, ThereFore the answer output shoud be true if you have gs.hasRole(change_manager') under your if statement



Either it is something like


if(gs.hasRole("Change Manager") ||   parent.state=='3' || parent.state=='4' || parent.state=='-2' || parent.state=='-13' || parent.state=='-14' || parent.state=='2' || !parent.active) {


  answer = true;


} else {


  answer = false;


}




OR the following :



if(!gs.hasRole("MPl Change Manager") ||   parent.state=='3' || parent.state=='4' || parent.state=='-2' || parent.state=='-13' || parent.state=='-14' || parent.state=='2' || !parent.active){


  answer = false;


} else {


  answer = true;


}


Really Appreciate for the quick response.



i just copy pasted the same code and tried but it didn't hence at least i want to show the EDIT button to users with role MPI Change Manager so i tried below code but it doesn't work.



if(gs.hasRole("Change Manager"))


  {


  answer = true;


  gs.log('Inside if List Control EDIT');


} else {


  answer = false;


}



But i see that log is getting updated in the script log statements.


The change_task table should be editable to the user. Make sure the MPI


Change Manager has write access to the table.


Hi Santosh,



I have created a write ACL for change_task table with this role.