1

A bit of background:

I'm trying to emulate the behavior of the default "New" button w.r.t. automatically setting the parent object in the new object form. So, for instance, if I click the "new opportunity" button from the opportunity related list on the account screen, the account is prepopulated for me because the URL it creates is "006/e?retURL=%2F001A0000010o2zs&accid=001A0000010o2zs" (i.e. has a reference to the account ID).

This works with custom objects, too, but the "prepopulate" field is of the form "CF00NA000000AGyU2=Burlington+Textiles+Company&CF00NA000000AGyU2_lkid=001A0000010o2zs" where CF00NA000000AGyU2 is a random identifier assigned by Salesforce to the account lookup field. There doesn't seem to be a way to query that value through the metadata API, but I can do it through the tooling API via:

/services/data/v29.0/tooling/query?q=SELECT+Id,DeveloperName,NamespacePrefix+FROM+CustomObject+WHERE+DeveloperName='Order'+AND+NamespacePrefix='XX_ORD1'

and then:

/services/data/v29.0/tooling/query?q=SELECT+Id,DeveloperName,NamespacePrefix,TableEnumOrId,FullName,Metadata+FROM+CustomField+WHERE+DeveloperName='AccountLookup'+AND+NamespacePrefix='XX_ORD1'+AND+TableEnumOrId='(fill in value from prior call)'

My question:

It works OK (besides being a bit slow) most of the time, but when a platform user tries to invoke it, I get the error message in the title:

[{"message":"sObject type 'CustomEntityDefinition' is not supported.","errorCode":"INVALID_TYPE"}]

I can't find any documentation indicating that platform users can't use the tooling API; I've verified that they can use the other REST APIs. Is there some profile setting I need to enable for this? The documentation is pretty sparse; it just talks about how to use the tooling API, not how to enable it. I definitely have "API enabled" for the profile in question.

2

I have encountered the same issue, the tooling API requires view all data permission when querying the custom object.

Tooling API Issue

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.