apex-toolingapi icon indicating copy to clipboard operation
apex-toolingapi copied to clipboard

showing that ToolingAPI.CustomObjects is an invalid type.

Open ashish-sharma-1710 opened this issue 8 years ago • 8 comments

I tried to access a custom field id of Case object but it is showing compile time error that ToolingAPI.CustomObjects is an invalid type. no idea, why showing this.

ashish-sharma-1710 avatar Jan 19 '17 18:01 ashish-sharma-1710

sorry for the typo, it is showing ToolingAPI.CustomObject is an invalid type.

ashish-sharma-1710 avatar Jan 19 '17 18:01 ashish-sharma-1710

Are you using the SOAP or REST version of this API? The SOAP version is in the main branch, the REST version is in another branch.

afawcett avatar Feb 18 '17 21:02 afawcett

I'm facing same issue (Line: 7, Column: 53 Invalid type: ToolingAPI.CustomObject) when trying to execute example provided by Andy (https://andyinthecloud.com/2014/01/05/querying-custom-object-and-field-ids-via-tooling-api/) I installed SOAP version using the below link https://githubsfdeploy-sandbox.herokuapp.com/app/githubdeploy/afawcett/apex-toolingapi

laxmanvattam avatar Mar 17 '17 06:03 laxmanvattam

I am also facing the same Issue.Any updates on this?

orymeyer avatar Apr 08 '17 14:04 orymeyer

Take a look at this for an approach that does not require Tooling API. Please note however the use of field ID's is not supported by Lightning Experience.

afawcett avatar Apr 15 '17 04:04 afawcett

I'm facing the same issue. Is there an update on this? I'm using the SOAP version. Thank you.

emmanuelflores57 avatar Jun 22 '17 17:06 emmanuelflores57

@emmanuelflores57 A brief history of this project is in order first :) We've gone back and forth a few times on whether to support SOAP versus REST versus both. Currently, we have both on github, but in different repositories.

This repository is the SOAP version, and it has been refactored a bit since Andy posted the example on his blog. In order to query for something via the tooling API, the code example now looks something like the following:

ToolingAPI toolingApi = new ToolingAPI();
List<ToolingAPIWSDL.CustomObject> customObjects =
     (List<ToolingAPIWSDL.CustomObject>)toolingAPI.query('Select Id, DeveloperName, NamespacePrefix From CustomObject Where DeveloperName = \'Product\'','ToolingAPIWSDL.CustomObject').records;

System.debug('CustomObjects: ' + customObjects);

A few things to note here:

  • You can swap out CustomObject for any of the supported metadata types that you can query.
  • You have to pass in the ToolingAPIWSDL. as a string / second parameter to the query method currently (because reasons)

dancinllama avatar Jul 12 '17 13:07 dancinllama

Hi folks, sorry for the confusion, my blog post is based on the REST version, here, https://github.com/afawcett/apex-toolingapi/tree/apex-toolingapi-rest. I'll update my blog post as well.

afawcett avatar Aug 06 '17 18:08 afawcett