function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
haripriya.maturiharipriya.maturi 

How to assign a List View to EnhancedList other than ListId

Hi,

 

I have created 2 ListViews for an object and using them in 2 different visualsource pages(<apex:EnhancedList>), iam using a attribute called " listId " they are working fine in my development organization. But, facing problem after installation of our package in other organization. Error is list id is org specific. As the ID's differ in other organization

 

<apex:enhancedList id="tasks" listId="00BE0000002lPpc" height="480" rowsPerPage="25" customizable="false"  rendered="true" />

 

below is the enhancedList which iam using in aother page 

 

<apex:enhancedList id="mytasks" listId="00BE0000002lMJL" height="480" rowsPerPage="25" customizable="false"  rendered="true" />

 

So, is there any other way to use those listviews.Kindly help me out. 

 

 

Thanks in advance,

Haripriya.

 

 

NinaNina

It is an old question but maybe someone can use this solution:

 

<apex:page standardController="ObjectName" recordSetVar="objects" extensions="CuctomController">
<apex:enhancedList type="ObjectName" listId="{!listViewId}" height="500"/>
</apex:page>

public with sharing class CuctomController {

public String listViewId{get; set;}

public CuctomController(ApexPages.StandardSetController controller)
{
    System.SelectOption[] listviews = controller.getListViewOptions();

    for(SelectOption so : listviews){
       if(so.getLabel().startsWith('mytasks'))
          listViewId = so.getValue().left(15);       // listViewId has to be 15- char ID, value is 18-char.
       } 
    }
}

 

You can also pass a url parameter to find specific listview name.

 

Best, Nina