Hiding "New" Button on Related List Based off of Parent Variable

alexcharleswort
Tera Expert

I have two tables: The first is u_supply_requests and u_supplies_to_order. I created a related list on the u_supply_request form to include related u_supplies_to_order. What I want to have happen is when the u_supply_request form's u_state != 2, hide the new button on the related list.

(u_state is a string variable with choices and one of them is "Waiting for Line Items" with a value of 2)

I have already gone into the create ACL for u_supplies_to_order and added this script:

if(RP.isRelatedList())

  {
  if(parent.u_state == 2)

  answer=true;
  else

  answer=false;  
}

**I also added the role public to the acl - same role on the u_supplies_to_order table**

but, that doesn't work. all it does is, no matter what the state of u_supply_requests, when I click new on the related list, it show the u_supplies_to_order form with everything as read only.

Any help would be much appreciated!

Thanks in advance!

7 REPLIES 7

alexcharleswort
Tera Expert

I put in a different script in the ACL. At least this only makes fields read only when the state is in the correct condition. Still doesn't hide the button, though. Could the lack of List Controls be because it is in a global scope??



var answer;


if(parent.u_state != 2){


  //Do not remove the 'Edit' button


  answer=false;


}


else{


  //Remove the 'Edit' button


  answer=true;


}


answer;


HI Alex,



Did you find a solution? I am having similar issue with project and resource plan, tried list control and acls but same issue as yours



please let me know



regards


k



Sadly, i have not been able to find an answer for this. Sorry, Karthik.