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
Gulshan_7890Gulshan_7890 

system.security.NoAccessException: Create access denied

Hello,

 

I have a visualforce page with a button which is used to execute some actions and then refresh the page.

In my code, I create instances of a custom object say Custom__c but do not perform any dml with the instance of the object.

 

I get the following error:

 

system.security.NoAccessException: Create access denied for Custom__c

 

when I click the button mentioned above while running as a User that has only ReadOnly access to object Custom__c.

 

Does anyone has a solution for this.

 

Thanks,

Gulshan.

KrishSFDCKrishSFDC

HI Gulshan,

 

Please check the following link once.

 

https://success.salesforce.com/answers?id=90630000000h3THAAY

 

Thanks
Gopi
DBSync LLC
www.mydbsync.com

 

Gulshan_7890Gulshan_7890
Thanks Krish.
I came upon this post.
But the solution proposed i.e. change the first line of apex code from "public with sharing..." to "public without sharing..." or add create permission to your profile (setup / manage users / profiles / your profile / check create checkbox in account object) would not be the best option in our case.

Thanks again,
Gulshan.