The related list section on a form can display related lists based on 1:n relations, but also lists based on relationships [sys_relationship]. The GlideForm class contains methods to control the visibility of these lists on the form. If we want to show / hide a particular list, we must pass the listTableName argument to the method in order to identify the list. This raises the question: What is the name of a related list or relationship, and where can I find it?

The easiest way is to look at the list control for a related list:

Here we have the name of the related list, so now we can control its visibility using g_form methods:

g_form.hideRelatedList('incident.problem_id');

Lists based on relationships are controlled in the same way, however it must be noted that the documentation is a bit sloppy as it instructs us to use the sys_id of the relationship – and this won’t work. What we actually have to use is the sys_id with a ‘REL:’ prefix, exactly as shown in list control: