How to create duplicate relatedlist in any form

Renu9
Tera Contributor

Hi All,

Can we duplicate the related lists on the same form.?

If yes, how to do it.

I am having feature and release tables , where in feature record, there is a reference field of release table with field name parent. So, it created a related list on release form.

In my requirement I need to duplicate it and add few conditions.

Thanks in Advance

1 ACCEPTED SOLUTION

Try this

(function refineQuery(current, parent) {

current.addQuery('u_deliverable', 'Main Deliverable');
current.addQuery('parent.number',current.number);
gs.addErrorMessage("feature is " +parent.getDisplayValue());
gs.addErrorMessage("release is " +parent.number);

})(current, parent);

Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

View solution in original post

6 REPLIES 6

Voona Rohila
Kilo Patron
Kilo Patron

Hi Renu

Yes You can create a related list with the filters you need.

  1. You need to create a Relationship https://docs.servicenow.com/bundle/paris-platform-user-interface/page/administer/form-administration...
  2. After you create a relationship, navigate to your form and bring the related list onto your form.

Try and let us know If you're stuck.

example : https://docs.servicenow.com/bundle/paris-platform-user-interface/page/administer/form-administration...


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

Try this

(function refineQuery(current, parent) {

current.addQuery('u_deliverable', 'Main Deliverable');
current.addQuery('parent.number',current.number);
gs.addErrorMessage("feature is " +parent.getDisplayValue());
gs.addErrorMessage("release is " +parent.number);

})(current, parent);

Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

Vishnu Prasad K
Giga Guru

Hi Renu,

 

 

You have to create a different Relationship record with the same conditions, and then add it in the related list. When creating the relationship records you can add the conditions also

Hi @Vishnu Prasad K G 

Query from table :rm_feature

Applies to table: rm_release

Query with:

(function refineQuery(current, parent) {

current.addQuery('u_deliverable', 'Main Deliverable');
current.addQuery('parent.getDisplayValue()',parent.number);
gs.addErrorMessage("feature is " +parent.getDisplayValue());
gs.addErrorMessage("release is " +parent.number);

})(current, parent);

 

number is a field on release table, parent is a field of reference type(rm_release) on feature table.

Even though both the error messages are giving the same result, script is not working for current.addQuery('parent.getDisplayValue()',parent.number);

 

Please suggest any changes