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
asadim2asadim2 

Tooling API error when setting standardController

I have this very simple script on the JSforce script executor (https://jsforce.github.io/document/#tooling-api):
var apexBody = "<apex:page standardController='Account'>Test</apex:page>"; conn.tooling.sobject('ApexPage').create({ markup: apexBody, name: "PageTest", masterlabel: "PageTestLabel" }, function(err, res) { if (err) { return console.error(err); } console.log(res); });

I am in a DE org as Sys Admin. I recall getting the same error while ago when I tried the Tooling API in Apex:
FIELD_INTEGRITY_EXCEPTION: Object type not accessible. Please check permissions and make sure the object is not in development mode: sObject type 'Account' is not supported.. Original queryString was: 'SELECT Id FROM Account WHERE id = '000000000000000'': Markup

The script works without setting standardController in the markup. Any ideas? Thanks.
Amit Chaudhary 8Amit Chaudhary 8
I hope you issue is resolved in below post.
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000BOkg

Yes Account is not Supported :-

What Does Tooling API Do?
1) Manage working copies of Apex classes and triggers and Visualforce pages and components.
2) Check for updates and errors in working copies of Apex classes and triggers and Visualforce pages and components and commit changes to your organization.
3) Set heap dump markers.
4) Overlay Apex code or SOQL statements on an Apex execution and view detailed debug log and heap dump information.
5) Set trace flags and generate log files for yourself or for other users.
6) Access debug log and heap dump files.
7) Manage custom fields on custom objects.

Please check below post for more detail on tooling API.
https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/intro_tasks.htm

Please mark this as resolved if your query or issue is resolved.

Thank,
Amit Chaudhary
asadim2asadim2
No it is not. This is a different question.
Ben EdwardsBen Edwards
A bit old now, but adding here in case anyone comes across the same problem.

Long story short, this process is supported using the standard REST API, rather than the Tooling API. The Tooling API docs actually says:
To create a Visualforce page, use the Force.com REST API or the Metadata API.
Found here:
https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_apexpagemember.htm

So if you just drop the "/tooling/" aspect from your endpoint, it should work fine.

Eg.
/services/data/v39.0/sobjects/ApexPage/
And POST:
{
  "name": "MyPage",
  "masterLabel": "MyPage",
  "markup": "<apex:page standardController=\"Account\"><\/apex:page>",
}