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
Shiv ShankarShiv Shankar 

Sboject not rendering on VF Page

Hi all,
I have one visual force page and it's respective controller.
Controller code :
public with sharing class testAccount
{
   public SObject act{get;set;}
   public testAccount()
   {
      act = new Account();
   }

   public void save()
   {
       insert act;
    }
}

VF Page :<apex:page controller="testAccount">
<apex:form >
   <apex:commandButton action="{! save}" value="save"/>
  <apex:pageblock >
   <apex:pageblocksection >
    <apex:inputField value="{! act.Name}"/>
    <apex:inputField value="{! act.Type}"/>
    <apex:inputField value="{! act.Industry}"/>
   </apex:pageblocksection>
  </apex:pageblock>
</apex:form>
</apex:page>

while rendering page i am getting following error :

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.

But in controller if change the first line (public SObject act{get;set;}) to like this way :
public Account act{get;set;} , i don't get any error.
In my requirement i don't know which object fields need to be display on VF Page. So i want to use sObject. but it's not working the way i want. please help it's urgent. Thanks
Vinita_SFDCVinita_SFDC
Hello,

As you are using with sharing, so it will take sharing in to considerations.

Are you not system administrator? Seems you do not have access on few objects.