Hiding a Related List from the Layout Form

Elias11
Giga Expert

Hi Experts

I need to hide a related list from a Form which I have added it as a form Layout an dnot as a related list,

I have a section and in this section I wanted to add this related list. I right click and Personilize form and add this List.

now I need to hide this list and show it only if the field above showing YES.

I have tried in the Client script and UI Policies with
g_form.showRelatedList('u_other_employee.u_change');

OR

g_form.setVisible('u_other_employee.u_change', false);

But nothing happens.

BTW I got the name of the related list from the List control Value.

if I add this list from the related list layout the script works and I can hide it, but why it doenst work when it is from the Form ?

anyone has an idea?

Thanks

Elias

1 ACCEPTED SOLUTION

If you say that you are using a related list in a section, i think you mean embedded list.



Check this link, it explains how you can controlvisibility of related lists and embedded lists both


http://www.servicenowguru.com/scripting/client-scripts-scripting/hiding-related-lists-embedded-lists...


-Anurag

View solution in original post

6 REPLIES 6

If you say that you are using a related list in a section, i think you mean embedded list.



Check this link, it explains how you can controlvisibility of related lists and embedded lists both


http://www.servicenowguru.com/scripting/client-scripts-scripting/hiding-related-lists-embedded-lists...


-Anurag

Elias11
Giga Expert

THANK YOU A LOT IT WORKS



Yes indeed it was the embedded list and I have did the same as in the Guru telling me and it works now I was able to hide it


this is my code.


var list = $$('div[tab_caption="Other Employees"]')[0];


      if(list.hasClassName('embedded')){


      list.hide();


}