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

Vikas-Malhotra
Mega Guru

Hi Alex,



Make sure you have created the ACL of   "None" type. I guess you have created the ACL as of type "*".




Hope it helps.



Thanks and Regards,


Vikas Malhotra


This is the one I made:


acl.PNG


Mihir Mohanta
Kilo Sage

Hi Alex,


No need to write ACL for it.You can achieve it by using list control.


Write click on the header of the related list.Go to list control.


Add script in the Omit New Condition script editor like :


find_real_file.png





Thanks,


Mihir


I've been trying to get to List Controls all morning, but I don't think that's available for this table. when I go to the form and right click on related list the only options I get are "Filters >" and "Refresh List".



I went to the list of List Controls and my table is not listed and when I try to create a new one, it won't let me add anything to the table field.