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
Graham_MacRobieGraham_MacRobie 

Programmatic Access to Views?

Hi,

 

I'm creating queue objects (QueueSObjects) through Apex code.  That works great.  Unfortunately, every time I create a new queue, Salesforce also automatically creates a View to go along with that queue.  I don't want the View, in part because it clogs up customer portal users' list of Views, even though they can't access the objects "inside" these other Views.  I'd like to delete the View, cause it to not be created in the first place, or simply alter its visibility (which defaults to public), but programmatic access to modify Views seems to be eluding me.

 

I saw a post from a couple years ago where someone said it's not possible to access Views through the API.  Is that still true?  Can anyone think of another way around this problem?

 

Thanks very much in advance.  I really appreciate your help!

mtbclimbermtbclimber
Views are exposed in the Metadata API but that is not accessible from Apex today.  Otherwise there is no mechanism to avoid this default behavior to my knowledge.
JonPJonP

Even for components exposed in the Metadata API, if they are system-generated you may not necessarily be able to delete them.  Off the top of my head, I don't know whether the system allows a Queue to have no Views at all.  If you can delete the View from the Setup UI, you probably could do it through the Metadata API.

 

Jon

salesforce.com Product Manager