2

I am creating a visualforce page from apex, using the metadata api. To call the metadata api I am using https://github.com/financialforcedev/apex-mdapi

    MetadataService.MetadataPort service = createService();     
    MetadataService.ApexPage apexPage = new MetadataService.ApexPage();
    apexPage.apiVersion = 25;
    apexPage.fullName = getPageName(objectName);
    apexPage.label = 'myprefix'+ objectName;
    apexPage.content = EncodingUtil.base64Encode(Blob.valueOf(getPageMarkup(objectName)));
    List<MetadataService.SaveResult> results = service.createMetadata(
            new MetadataService.Metadata[] { apexPage });

This creates the page succesfully, but it is only available to System administrator profile(creator). I want the page to be available to all profiles. How to do this?

1
  • you can go to profiles and add the page you have created to that profile.
    – sunny
    Commented Feb 5, 2015 at 14:58

1 Answer 1

6

You can either do it manually from the Page Security section (Setup/Develop/Pages --> Security link next to your page name). This is easier than going to the profile, because you can give access to all profiles at the same time.

You can also update the ProfileApexPageAccess part of the Profile Metadata: https://www.salesforce.com/us/developer/docs/api_meta/Content/meta_profile.htm#profileApexPageAccess_title

You must log in to answer this question.

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