0

Through admin I am able to access a custom visual force page : https://c.ap5.visual.force.com/apex/EditCustomerData

but when I try to access this page through a different user, I am getting the below issue: Insufficient Privileges You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary

I provided all the permission on all custom objects which used for that visual force page. I am using a custom visual force page which use a custom controller.

apex code is as below :

public class EditCustomerData
    {
       public List<APEX_Customer__c> customerDetails{get;set;}
       integer count=0;
       public Integer countHits{get;set;}
       public void trackVisits()
       {
       count=count+1;
       Tracking_1__c track=new Tracking_1__c(
       Users__c=UserInfo.getUserId(),
       VF_Page_Visited__c='https://c.ap5.visual.force.com/apex/EditCustomerData',
       Datetime_Visited__c=datetime.now(),
       Counter__c=count
       );
       insert track;
       countHits=[select count() from Tracking_1__c where Users__c=:'0057F000000FILX'];
       System.Debug('Total Hits'+ countHits);
       }
       public EditCustomerData()
       {
           customerDetails=new List<APEX_Customer__c>();
           customerDetails=[select id,Name from APEX_Customer__c];
       }
       public PageReference Edit()
       {
           PageReference myPage=new PageReference('https://c.ap5.visual.force.com/apex/EditCustomerData1');
           myPage.SetRedirect(true);
           //Id id= System.currentPageReference().getParameters().get('Id');
           Id custId = ApexPages.currentPage().getParameters().get('customerId');
           System.Debug('value of id new :' +custId );
           myPage.getParameters().put('myid',custId );
           return myPage;
       }
    }
visual force code is as below :
<apex:page controller="EditCustomerData" showHeader="true" action="{!trackVisits}">
  <!-- Begin Default Content REMOVE THIS -->
  <apex:form >

  <apex:pageBlock >
  <apex:outputText label="Count" value="{!countHits}" />
      <apex:pageBlockSection >
          <apex:pageblockTable value="{!customerDetails}" var="customer">
              <apex:column headerValue="Action">
                  <apex:commandLink action="{!Edit}" value="Edit">
                      <Apex:param value="{!customer.Id}" name="customerId"/>
                  </apex:commandLink>
             </apex:column>
             <apex:column value="{!customer.name}"/>

          </apex:pageblockTable><br/>

      </apex:pageBlockSection>
  </apex:pageBlock>
    </apex:form>
</apex:page>

Should I set any other permission for accessing a particular page ? Please suggest something. Thanks in advance.

1
  • 1
    Have you give the profile access to the Visualforce page? This is required.
    – Girbot
    Jun 7, 2017 at 7:29

1 Answer 1

1

Hi you have to go to visual force page and then go to security and provide access to all profile which you want. enter image description here

0

You must log in to answer this question.

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