Creating related list to the same table but wih different filters?

Mika Latvala
Tera Contributor

Hi team.

 

I was asked to create a related list to an existing table, but with different classification - and make the list editable. In practice I'm talking about Program table (pm_program) where a related list to related projects (pm_project) already exists. However, there is a custom attribute "Project type" at the project record and I need to duplicate the existing related list with different filters, one list for project type A and another for project type B.

I was trying to achieve this by copying the existing related list entry (sys_ui_related_list_entry) with Insert&Stay and I was able to achieve 2 lists, but when I try and configure the lists from configure -> list control, both lists are updated.

Then I tried to create a Relationship (sys_relationship), but editing is not possible at all in this case. I had to create a copy of the ootb Edit-button and ignore the ".isOmitEditButton()" condition to get the button visible, but when I click the button, system just keeps on loading the list and does nothing.

MikaLatvala_0-1763464178839.png


Any ideas, please?

2 REPLIES 2

lpruit2
Kilo Sage

Greetings @Mika Latvala. I was able to achieve this by creating a 2nd Relationship record which I believe is what you are discussing in your 2nd attempt. I'll include the steps I took to achieve this below. 

 

  1. Navigate to the Relationship table [sys_relationship] and create a new Relationship record.
    1. Name: Custom Project RL
    2. Applies to table: Program [pm_program]
    3. Queries from table: Project [pm_project]
    4. Query with
(function refineQuery(current, parent) {

	// Filter on Projects with the Investment type of Cost Reduction
	//Replace 'investment_type' with YOUR custom field and value
	current.addQuery('investment_type', 'cost_reduction');
	current.addQuery('primary_program', parent.getUniqueValue());

})(current, parent);
  • Navigate back to the Program table [pm_program]. 
    1. Click into any Program record to bring up the record and form.
    2. Click the Additional Action menu > Configure > Related List 
      1. lpruit2_0-1763475990753.png

         

    3. This brings up a screen with a slush-bucket of available Relationships / Related Lists that you can add and remove. In my test case, the new Relationship I created was called "Custom Project RL". I located the record in the left window, clicked the Add arrow in the middle, and ordered it within the right window to be just after the Project -> Program Related List.
      1. lpruit2_1-1763476163464.png

         

    4. Click Save
  • Verify you now see the new Relationship / Related List which means you should now have TWO separate Related List with different filter conditions.
    1. lpruit2_2-1763476266931.png

       

From here, it should be as simple as creating or updating Project records to meet the separate filter conditions which will display each Project under the correct Related List. 

 

I hope this information helps you!

Thanks for the tip, but as I wrote, I already did this but editing is not possible in this case (meaning the Edit-button is not working when you create a Relationship-type related list).

Of course, this type of list shows the records matching the criteria, but editing the list is the key requirement in this case.