Hide/Show lookups

Hello -

We have a lookup field that has a many-to-many relationship. According to the wiki:

This combined with not being able to find the field in the Then/Else section of a new Layout Rule makes me think you can’t use the field in Layout rules.

We would like to hide/show this field (3 of them actually). Has anyone ever been able to do this?

If so, how were you able to do it?

The field having many to many relationship can not be used in layout rule. But for hiding purpose you can use some custom JavaScript.

Goto that Object which contains Many to Many relation field.

Get the field id by inspecting in your browser.

Goto Form>Form Script and in Onload section put the script
("#id of the section").hide(); e.g ("#m2m_ViewTest_row").hide();

Normally the id of that field is objectName_fieldName_row.