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
Nazeer AhamedNazeer Ahamed 

Where all list view names are stored

Hi.,
I want to place a custom button in custom object list view. I don’t want user to click this button from any other list view other than desired one.
There is no option to make list button visible only in desired list view, it will be there in all list view.
Finally I desired to throw a message to user, when they click that list button other than desired list view.
Here I need to check the List View Name, how can we get the list view name in Visual force page / extension apex class.
Where all list view names are stored, is that object / table is accessible / can we query that object in apex class.
E.g:
List View Name A, I want to place custom button A here.
User should not have access to button A in list View B, C and etc(We cannot make it this happen in standard list view) hence user clicks button A from List view B or C.
I want to throw message to user.
Note: PDF page will be render to me when I click on custom button A.
werewolfwerewolf
There's really no easy way to do that.  All you may be able to know about the list view on that page is its ID, and you might possibly be able to resolve that ID to a name if you use the metadata API, but it's going to be a tough row to hoe if it is even possible.
AthiSachiAthiSachi
hi,
Did you find solution? I have the same requirement
Nazeer AhamedNazeer Ahamed
All the list views are stored in system object ListView. Find out using below query. 

Select l.SobjectType l.Id, l.DeveloperName From ListView l

It was long time, not sure what I did. However still this is approach to go ahead. 
"Finally I desired to throw a message to user, when they click that list button other than desired list view." - As mentioned in the original question. 
This may not completely answer and some thoguhts to go ahead. 

 
AthiSachiAthiSachi
I found workaround. I would like to check your approach too.. Will update soon .. Thanks
AthiSachiAthiSachi
One question: How to get the view name/id from UI? i assume i need to compare that name/id with Sobject ....Thanks
ryanschierholzryanschierholz
Athi, I am not sure if this is what you are asking, but for me, I found it by going to the list view of the object, then clicking the gear icon and choose 'Rename' ... it then shows the API of the current list view. 
BOUTYEBI MAROUANBOUTYEBI MAROUAN
Thanks @Ryan, that works for me!