Is there any way to have 2 different instances of a related table (on the same form) display different fields?

rita_m
Tera Guru

Is there any way to have 2 different instances of a related table (on the same form) display different fields?

I've a table that has a many-to-many related list that goes back to itself.

Level 1 records can only see/add level 2 records, and level 2 records can only see/add level 1 records.

Even if you create 2 different instances of the related list on the same form, changing the default list view fields on ONE of the instances ends up changing the default list view fields on BOTH.

I'm hoping to get it set up so that I can have 2 related lists on the form with DIFFERENT default list view fields on them.   I'd hide one of them (with a client script) if you were on a level 1 record, and hide the other if you were on a level 2 record.

Has anyone else ever set up multiple related lists in ServiceNow that show the same table with different fields before?   Any pointers?

Much appreciated.

-Rita

1 ACCEPTED SOLUTION

rita_m
Tera Guru

Just if people are interested...


I've discovered how to do this.



The secret is a module called "Relationships"



Create a new one an


Creating Defined Related Lists - ServiceNow Wiki


"Applies to table" is the parent table


"Queries from table" is the M2M table.


Set the "Query with" using the "parent" keyword:


current.addQuery('m2m_field_linked_on', parent.sys_id);



Good luck!


View solution in original post

1 REPLY 1

rita_m
Tera Guru

Just if people are interested...


I've discovered how to do this.



The secret is a module called "Relationships"



Create a new one an


Creating Defined Related Lists - ServiceNow Wiki


"Applies to table" is the parent table


"Queries from table" is the M2M table.


Set the "Query with" using the "parent" keyword:


current.addQuery('m2m_field_linked_on', parent.sys_id);



Good luck!