We need to add a custom fields to identify some special VF pages through a query.

Is it possible to add a custom field investor_type as a string type on the ApexPage object?

How to do that? Didn't seem any entry could let me add the field on my dev ORG. Thanks

SELECT ID, NAME FROM ApexPage LIMIT 10  WHERE investor_type = 'bank'
  • 3
    You seem to be having an XY Problem. Please take a step back and try to describe at a higher level what you are trying to achieve.
    – Adrian Larson
    Commented Jan 4, 2018 at 20:46

1 Answer 1


Some extra detail could help, but I think a Custom Metadata Type could be useful to you. Unlike a standard object, you are able to modify them, adding new fields and creating new records with various values.

A possible solution would be to create a Custom Metadata type of "PageInfo", and add a custom field called "Page Type" (Picklist with your various types), and "Page Name" (The name of the apex page to redirect the user to).

When your user attempts to access your page, you can query your custom metadata type, and redirect to a page by first finding the correct "Page Type", and then using the "Page Name" to create a PageReference to the apex page, redirecting the user to the correct page.

You'd wind up with a method which could look something like this:

public PageReference Redirect() {
    String someType = ApexPages.currentPage().getParameters().get('someType');

    Page_Info__c somePage = [
        SELECT Id, Page_Type__c, Page_Name__c 
        FROM Page_Info__c 
        WHERE Page_Type__c = :someType

    return new PageReference(somePage.Page_Name__c);

Read more about Custom Metadata Types.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .