19
votes
Accepted
Query the created date of a custom field?
The FieldDefinition table doesn't have a CreatedDate field, but CustomField does (but it's not in the documentation). It seems to me that you'll need to perform two queries and then match up the ...
12
votes
Accepted
Is there a *public-facing* list of GACK codes?
I work for Salesforce on the Apex product team, but this is mostly personal opinion and not an official stance.
is there a GACK ID to Metadata Type list for issues around the Metadata/Tooling/Bulk ...
9
votes
How can I activate a Lightning Page via metadata?
[This] can be achieved by using the following in an
applications/AppName.app metadata file:
<profileActionOverrides>
<actionName>View</actionName>
<content>PageName&...
8
votes
Accepted
Is it possible to use the Tooling API to update field level security on Profiles and PermissionSets?
The objects you're looking for are UserEntityAccess and UserFieldAccess, for object security and field security, respectively. Unfortunately, it appears that these tables are read-only, so you're ...
8
votes
Accepted
How can I know via API how many fields are allowed to create in custom object
yes, use EntityLimit of Tooling API
Represents the limits for an object as displayed in the Setup UI.
you need to look CustomFields type and get Remaining field value.
Example, how to get all ...
8
votes
Is there a *public-facing* list of GACK codes?
The GACK ID values are derived heuristically, and are only meant for grouping crashes with the same root cause together, in order to define the frequency of the crash. It is up to a human to read the ...
7
votes
Accepted
Salesforce Packaging Bug with Lightning Components? (Warning: very strange!)
I was able to replicate this issue in two packages, so have raised it with support, and they are currently researching it (they were able to re-create it)
One thing I noticed as a workaround - I had ...
7
votes
Accepted
Create/Update Global Value Set using Tooling API
As mentioned by Daniel, you can develop code to create/update GlobalValueSet.
By using tooling api, we will need to make http request to endpoint (/services/data/v41.0/tooling/sobjects/GlobalValueSet)...
7
votes
Accepted
Which Tooling API Objects can be queried in Apex?
As of this writing, the following types are available in the Schema namespace and can be queried (with one noted exception). These objects are listed in the Tooling API Developer Guide, but not in the ...
6
votes
Accepted
Object type 'SandboxInfo' is not supported
The API is applicable only for PROD instance from where different sandboxes are spun.Hence it won't return any result for sandbox
6
votes
Describe not returning Inactive picklist values via API
I believe this to be a current limitation of the API for picklist fields.
I tried as well to get field metadata for a deactivated picklist value. It didn't come back, even though there is an active ...
6
votes
Accepted
Tooling API calls from Apex requires user to set up Remote Site Settings?
If I wanted to distribute something using this through the AppExchange, should I have to include instructions to add the endpoint in the remote site settings? Or is there a way to automate this ...
6
votes
Accepted
How to send a PATCH HTTP Callout from Apex to Salesforce Tooling REST API
Use ?_HttpMethod=PATCH in the request URL.
public static HttpResponse makeHttpCallout(String url, String method, String body, Map<String,String> headers){
HttpRequest request = new ...
6
votes
Accepted
Is it possible to discover a sandbox version with a API request to a sandbox?
Making a call to the {your sandbox domain}/services/data REST API will return a JSON response with all the available API versions. Here is the JSON response:
[...,
{
"label" : "Winter '19",
"url" ...
6
votes
Calling Tooling API via ApexClass
You are sending the literal string EncodingUtil.urlEncode() instead of calling the method to build a string. You want:
String body = restGet( baseURL +
'/services/data/v47.0/tooling/query?'+
'q=...
5
votes
Accepted
Update an existing trigger with tooling API
Tooling API support update also. It is regardless of Component type.
All you need to do is create "MetdataContainer" using Tooling API.
Create Metadata Container
Get the Trigger Id
Change the body ...
5
votes
Accepted
Tooling API - Enable/Disable Parallel Test Execution?
Specifically to your question on "Disable Parallel Apex Testing". No, I don't believe there is currently an official method in the Tooling API that exposes this setting.
That said, with ...
5
votes
Tooling API - Enable/Disable Parallel Test Execution?
Perhaps it would help you to look at the Force.com Tooling API documentation, specifically on REST Resources. There are some URIs listed that look useful to you:
/runTestsSynchronous/
/...
5
votes
Tooling API from Visualforce - OK in managed package?
The rule of thumb for the security review is no self-modifying code. That is, suppose you want to publish an app that is an IDE and creates other packages. That's going to be OK as long as the ...
5
votes
Accepted
How to get dependent classes for a trigger?
You have not specified if you want this programmatically, so my guess is that you can get all dependencies with change sets.
Create a change set, and then add your trigger on it. Click on "View/Add ...
5
votes
Accepted
Cannot retrieve full class list from the org using tooling API?
You will need to change your strategy as including all the class names you have already queried is causing the query string to exceed the 20,000 character query limit.
The Partner API includes the ...
5
votes
create and update custom labels through ToolingAPI
We can use tooling API to create the custom label and its translation as below.
The Master label is stored in External String and translation is stored in ExternalStringLocalization
Request to create ...
5
votes
Finding sharing settings OWD
There's a better way to get this from apex directly without callouts now!
List<EntityDefinition> eds = [SELECT DeveloperName, ExternalSharingModel, InternalSharingModel FROM EntityDefinition];
...
5
votes
Tooling API in Apex - polymorphism, generic query() callout?
As you found, if you just use the direct QueryResult against the SOAP API and include anything in the fields beyond the ID you get the following response:
SOQL:
Select Id, Name from ApexClass
...
5
votes
Will LightningComponentBundle and LightningComponentResource mapped into the database like AuraDefinitionBundle and AuraDefinition
Via twitter, it sounds like they have added a work item to expose this functionality in a future release.
https://twitter.com/tahir_farhan/status/1085939366764134401?s=09
Cool. Let us get to work ...
5
votes
MetaData API and Tooling API
Yes, it's possible. You can access Workflow Rule metadata through the Metadata API. There is an Apex wrapper available, and its README and examples class include some examples that can be adapted to ...
5
votes
Querying Apex Classes & Dependent Test Classes
As a starting point, you will need to identify which Apex classes contain tests. From How to get a list of Test Classes in an org by sfdcfox:
ApexClass[] unitTests = [FIND '@isTest' IN ALL FIELDS ...
5
votes
Accepted
Finding unused Apex Classes with Tooling API and MetadataComponentDependency
I think the doc is clear that it will only list the relationships between components so the lack of one would not be returned.
Usage
Use SOQL queries to list the relationships between the metadata ...
5
votes
Accepted
Retrieving audit fields of a custom metadata type object
The values of system fields on the custom metadata object are only available via Tooling API. In the ontology of entities covered by Tooling API, you will not find a Custom Metadata entity. This is so ...
5
votes
Accepted
Use cases of different Salesforce APIs
In Salesforce, we have two general types of data: data, and metadata. Data are individual records, such as an Account record, or a User record. Metadata is configuration that describes the "shape&...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
tooling-api × 472apex × 148
metadata-api × 95
rest-api × 74
soql × 51
api × 34
metadata × 30
soap-api × 26
query × 20
custom-field × 17
managed-package × 14
visualforce × 13
java × 13
callout × 12
rest × 12
tooling × 12
lightning-aura-components × 11
trigger × 10
workflow × 10
code-coverage × 10
sandbox × 10
soap × 10
custom-object × 9
workbench × 9
deployment × 8