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
Heaven DevHeaven Dev 

DML operation Insert not allowed on ApexPage

Hello 

I am trying to insert data in standard Object in apex.  it given this error.

DML Error

Is there any setting permission issue. How can I solving this? 
Raj VakatiRaj Vakati
You can not insert the  ApexPage by using SOAP API. Use tooling API or metadata API to do it. 
Heaven DevHeaven Dev
Hello Raj,

Thanks you for given me reponse.


"You can not insert the  ApexPage by using SOAP API."

but I am insert account data in standard Object in apex. it not give me any DML Error.
 
public PageReference GenerateCode() {
        
        Account acct = new Account(Name='Acme', Phone='(415)555-1212', NumberOfEmployees=100);       
        insert acct;      
        ID acctID = acct.Id;      
        System.debug('ID = ' + acctID);       
        return null;
     }
So it Is there any setting permission issue?





 
Heaven DevHeaven Dev
Thanks Raj.

I have implement tooling API and getting success.

 ~/services/data/v41.0/tooling/sobjects/ApexPage  


https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/intro_rest_resource_examples.htm