Skip to main content
New
Stack Overflow Jobs powered by Indeed: A job site that puts thousands of tech jobs at your fingertips (U.S. only). Search jobs

Questions tagged [metadata-api]

Questions about the Metadata API provided by salesforce. The API that can be used to retrieve, deploy, create, update or delete customization information, such as custom object definitions and page layouts, for your organization. This API is intended for managing customizations and for building tools that can manage the metadata model, not the data itself.

Filter by
Sorted by
Tagged with
82 votes
2 answers
17k views

Has anyone, ever, successfully invoked the Metadata API from within Apex?

While researching a semi-related question posted here earlier, I dug up some interesting and conflicting information regarding whether it's even possible to use the Metadata API from within Apex. I ...
Adam's user avatar
  • 4,348
56 votes
17 answers
121k views

How to debug the mysterious "duplicate value found: <unknown> duplicates value on record with id: <unknown>" error

I've just spent several hours trying to fix a deployment that was failing with the following extremely helpful error message: Error: objects/Opportunity.object(2098,13):duplicate value found: <...
Vivek M. Chawla's user avatar
34 votes
6 answers
33k views

Getting Session ID in Lightning

Background I'm using Apex Wrapper Salesforce Metadata API to update some picklist values on the fly. (i.e. Every time a record is inserted/updated/deleted in Table A, I'm adding/subtracting picklist ...
Jose's user avatar
  • 2,142
34 votes
2 answers
452 views

Related Objects in User.layout Metadata on Winter '14

What's going on with the layouts/User-User Layout.layout metadata file? I have scripts that snapshot all of my metadata every day. Ever since we upgraded to Winter '14, the following lines are ...
Benj's user avatar
  • 11.2k
33 votes
2 answers
488 views

Which kind of issues will be shown at trust.salesforce.com and which issues will be omited?

In the context of a different question, we encountered a deployment performance degradation on EU5 of between 6000% to 10000% using Metadata-API. This means that work (saving a single APEX file to the ...
Uwe Heim's user avatar
  • 28.4k
28 votes
1 answer
12k views

difference between metadata and tooling API

What is the difference between metadata API and tooling API? When I read the documentation, they both appear the same to me from the metadata perspective. I would like to know how I can use it for ...
Kevin Bellati's user avatar
24 votes
5 answers
32k views

Generate complete package.xml for Org

I'm using the Force.com Migration Tool for Ant more and more. I currently have several organizations at different API versions (release previews, for example). Is there a way to generate a complete ...
Benj's user avatar
  • 11.2k
22 votes
7 answers
17k views

How to get a list of the managed packages (including version numbers) installed in an org?

For a continuous integration setup, I only want to install/upgrade some packages (through the new InstalledPackage mechanism) when necessary. I've looked at the Metadata WSDL (and documentation) and ...
Keith C's user avatar
  • 136k
22 votes
3 answers
34k views

How to push code to production with Visual Studio Code & DX

I am using Visual Studio Code to develop new functionality. However, after completing the testing in the sandbox, I want to push the code to production. When I choose "SFDX: Deploy Code to org", it ...
t0tl's user avatar
  • 373
22 votes
4 answers
5k views

Hard-Delete Objects Using the Force.com Migration tool

Is there a way to hard-delete custom objects using the Force.com migration tool? When you deploy a DestructiveChanges payload, the objects are "soft-deleted" and not erased from the platform. This ...
Kevin O'Hara's user avatar
  • 4,039
20 votes
3 answers
5k views

Ant vs other deployment tools

I am wondering if there are any use cases for using Ant specifically over all other deployment methods and tools? It seems Eclipse, changesets and packages have all the functionality you need.
Kris Moyse's user avatar
19 votes
3 answers
31k views

How do I get the length of a string field?

For a string field, is there a way to get the defined length of the field? For example say I allow a maximum of 10 chars, can I get that in apex? I am not asking how to get the length of a string (i....
PartOfTheOhana's user avatar
19 votes
6 answers
6k views

How to keep sandbox in sync with changes from other developers?

We are a team of 9 developers, working on a large project and commits are made to master branch all the time. When I needed to work on any new enhancement I used to pull everything from master branch ...
javanoob's user avatar
  • 8,887
18 votes
2 answers
30k views

How to retrieve layouts of customs objects belonging to a managed package?

I am trying to retrieve the layouts of all(standard + custom) objects from a test Enterprise org using package.xml manifest files. There are some customs objects that I have created on this org. ...
auny's user avatar
  • 773
16 votes
1 answer
16k views

Using Meta data api in apex

i know if u have to create a field in apex then u have to call meta data api of salesforce.i found only this link for implementation https://github.com/financialforcedev/apex-mdapi is there any other ...
mathlearner's user avatar
  • 2,151
16 votes
1 answer
16k views

Deleting custom object via destructiveChanges.xml and Metadata API deploy()

I've created a custom object in a developer edition org with the sole intention of deleting it via the Metadata API as per Deleting Components from an Organization. To do this I created the following ...
Daniel Ballinger's user avatar
15 votes
2 answers
4k views

Metadata API error while reading Picklist: Web service callout failed: Unable to find apex schema info

I am trying to read a custom dependent picklist field and update it's field-dependencies. I have followed the common resources found online and getting the below error: FATAL_ERROR System....
Santanu Halder's user avatar
15 votes
2 answers
2k views

Initiate an oAuth flow via an Auth Provider

I use the Metadata API and the Apex wrapper to create an AuthProvider and NamedCredential after the installation of my managed package app. MetadataService.NamedCredential cred = new MetadataService....
Robert Sösemann's user avatar
15 votes
2 answers
7k views

Creating/updating NamedCredential from Apex

Question Is it possible to create or update a NamedCredential from within Apex? Investigation I looked into available options, and it seems the SOAP API only supports the describeSObjects(), query()...
Adrian Larson's user avatar
  • 150k
15 votes
1 answer
10k views

How do I update Custom Label's value using apex? Which one would be a better option metadata api or tooling api? Please provide example

I'am working on post deployment automation process in salesforce. I am stuck on how should I update values in custom labels which needs tobe updated manually after a sandbox refresh.
AJINKYA RAUT's user avatar
15 votes
1 answer
478 views

Did something change with deploy run test behavior with sandboxes in Spring '14?

Starting a few days ago my apex class compilation time suddenly ground to a halt. After going into the setup deployment monitoring I was at first delighted with the new deployment monitoring UI, then ...
Ralph Callaway's user avatar
15 votes
1 answer
17k views

SFDX Deploy: Global Value Set Cannot Be Resolved

I am trying to use DX to deploy to a sandbox. It has been a major hassle. At this point the only error I get is this: Global value set 'External_Evaluation_Required__c' in record type 'Exception' ...
Chance's user avatar
  • 1,070
14 votes
3 answers
30k views

Property 'componentInstances' not valid in version 49.0 but Package.xml is version 48.0

I am trying to deploy a flexipage to a newly created sandbox org and I am getting the following error Property 'componentInstances' not valid in version 49.0 I have read the following links but ...
Syed Ahmed Jamil's user avatar
14 votes
2 answers
4k views

Lightning: is direct API access on the roadmap?

I'm programming developer tools and an IDE. Right now, my code is based on Visualforce and JavaScript. As described here, I would like to convert most of my API callouts form APEX to JavaScript. Also ...
Uwe Heim's user avatar
  • 28.4k
13 votes
1 answer
2k views

Metadata API deployments are failing in Spring '19

For some time now (several years) I've been deploying changes to Apex classes using the Metadata API deploy web method with an associated zip file containing the metadata and package.xml file. This ...
Daniel Ballinger's user avatar
13 votes
1 answer
3k views

Access MetadataAPI via JavaScript

We created an 100% native Salesforce IDE as a Managed Package which is using ToolingAPI and MetadataAPI via APEX. This works fine. But there is one thing which really bothers people after the ...
Uwe Heim's user avatar
  • 28.4k
13 votes
2 answers
702 views

Specify "Install for" when installing package via Metadata API

Trying to automate some package installs via Apex using the Metadata API. When you install a package via the UI you get asked who to install for (Defaults to Admins Only): Is there any way to ...
Eric's user avatar
  • 54.2k
13 votes
1 answer
570 views

How do I determine which sObjects and fields are valid to use with an Outbound Message?

We are creating OutboundMessages programmatically using the SOAP Metadata API. We've discovered that not all returned sObjects are supported and some supported sObjects have fields which are not ...
Vyrotek's user avatar
  • 1,365
12 votes
7 answers
11k views

Remove all old flow versions using SFDX

We have an old field referenced in older flow versions. We want to remove all older versions using SFDX and only upload the newest version without the field. Is it possible to do this without manually ...
toufik_at's user avatar
  • 370
12 votes
2 answers
3k views

Connected apps available via Metadata API?

When developing apps for the AppExchange, we use a development workflow in which each developer has their own DE org, but commits to a common source code repository (git in this case). We then use a ...
ArtieBrosius's user avatar
12 votes
2 answers
9k views

Dynamically set remote site Setting in Apex

I have created a managed package that uses tooling API for updating class, trigger etc. Everything runs fine with all sorts of testing. I have created this package in my Developer org. I had to set ...
Soberano's user avatar
  • 1,232
12 votes
1 answer
998 views

Will LightningComponentBundle and LightningComponentResource mapped into the database like AuraDefinitionBundle and AuraDefinition

I'm checking this on a Spring'19 v45 Sandbox in Execute Anonymous: [ select Id from AuraDefinitionBundle ] // ==> works fine! [ select Id from AuraDefinition ] // ==> flawless!...
Uwe Heim's user avatar
  • 28.4k
12 votes
1 answer
1k views

Create custom Index via Metadata API now possible?

While doing prodsync today I stumbled upon a folder named as customIndex. Funnily enough it had all custom indexes that we had asked SF to create for us. Once downloaded, I tried to save this in my ...
Pranay Jaiswal's user avatar
12 votes
1 answer
3k views

Why is there a big difference in profiles returned by "sfdx force:source:pull" and "sfdx force:mdapi:retrieve"?

I have a project with a scratch org created using some profiles that date from the MDAPI days. The profiles look good in the org. Having added some record types, I expected: sfdx force:source:pull ...
Keith C's user avatar
  • 136k
11 votes
3 answers
4k views

How do I successfully Deploy a Configuration Component for a Platform-Event Trigger to Override the Automated Process User?

I am trying to override the Automated Process user with another user for a platform event. This Salesforce documentation covers it: Configure the User and Batch Size for Your Platform Event Trigger ...
Gabriel Rivera's user avatar
11 votes
2 answers
12k views

Parent entity failed to deploy

I'm trying to use the metadata api to do a destructive change call on all non-packaged components in my sandbox. However, I keep receiving the following error: layouts/SocialPost-Social Post ...
jordan.baucke's user avatar
11 votes
1 answer
4k views

Can OWD be imported/exported as metadata?

I'm currently trying to create a scratch org which reflects our ludicrously complicated production org which contains hundreds of Roles. Upon deploying most of these, I get errors like: Error src/...
Brian Kessler's user avatar
11 votes
2 answers
14k views

How to extract the application brand logo image over an API?

In API 38 (Winter '17), when an "App Branding" image is uploaded through the Lightning Experience UI, the app metadata includes this brand information: <?xml version="1.0" encoding="UTF-8"?> &...
Keith C's user avatar
  • 136k
11 votes
2 answers
4k views

How is Permission Set Metadata Deployment changing in Summer '17 (API 40.0)?

Salesforce recently sent out an email entitled ATTENTION: Update to Permission Set Metadata Deployment in API 40.0 with Summer ‘17 Email contents: Product & Service Notification As an ...
Daniel Ballinger's user avatar
11 votes
1 answer
5k views

How do I Call the Salesforce API from a Lightning Component?

I have a requirement to make a call to the Apex Wrapper Metadata API from a Lightning component. The issue I am facing is that there is currently no native support for acquiring a valid API session ID ...
Daniel Fuller's user avatar
11 votes
3 answers
8k views

How to Search Workflow Rules or Validation Rules etc in Apex i.e. Metadata Search via Apex?

Recently I'm working on building something for developers/administrators - a handy 100% force.com app allowing to search metadata. Currently this app allows you to quickly search (from sidebar) custom ...
Chirag Mehta's user avatar
  • 1,261
11 votes
3 answers
9k views

Metadata API Custom Field Permissions (how to automate this process)

We are using the Metadata API to add Custom Fields to the Account object in Salesforce. We are able to create the custom fields, but then the Salesforce user has to manually login to their account ...
csMaps's user avatar
  • 121
11 votes
1 answer
2k views

Strategies to deal with slow metadata api performance

I'm slightly concerned that this question is might not fit here but, as you will read, I have a lot of time on my hands... Around release-time, Salesforce performance tends to plummet and right (in ...
Aidan's user avatar
  • 13.7k
11 votes
1 answer
5k views

Is it possible to delete a record type through Metadata API?

I'm deploying a destructiveChanges.xml file via Force.com Migration Tool to delete some listViews, Custom Fields, and Groups. I determined we also can remove some record types from Cases. I received ...
zainogj's user avatar
  • 1,854
11 votes
3 answers
404 views

Metadata+ToolingAPI access on CS14 (and other pods) extremly slow & No Support?

We are working on CS14. Starting last Friday we are suffering form a extreme performance loss on CS14. Loading and Saving Metadata via Tooling/Metadata-API is very slow. Operations which usually ...
Uwe Heim's user avatar
  • 28.4k
11 votes
1 answer
190 views

Programmatically detecting unpackaged metadata in org that depends on my package

My managed package is extensively customized and extended by some customers in their org. For our packaged objects they e.g. add Triggers + Custom Apex code Fields Validation Rules Workflows Process ...
Robert Sösemann's user avatar
11 votes
1 answer
1k views

Metadata converted from Metadata API won't push to scratch org with SFDX

I'm trying to convert one of my company's apps to Salesforce DX for continued development, but pushing the source retrieved from the current Developer Edition org isn't working. I've created a new ...
Dylan Bowman's user avatar
10 votes
3 answers
37k views

How do I insert records in Custom Metadata Type through Apex?

I want to write a trigger on a custom object (Template__c) such that it invokes the creation or update of Custom metadata type records. Since the fields are not writeable, how do I achieve this? I ...
nverm's user avatar
  • 199
10 votes
2 answers
352 views

Is there an API that returns consolidated metadata including layouts?

I believe I saw some information about a recent REST API that provided consolidated metadata including layout information. (For use by e.g. a mobile app that wants to base its screens on the metadata.)...
Keith C's user avatar
  • 136k
10 votes
1 answer
2k views

Using Metadata API from managed package post-install script

I'm trying to deploy a managed package that will create some new fields on the Opportunity object on install using the Metadata API. The entire code in the callout method below works in my dev org (i....
Harley Pellowe's user avatar

1
2 3 4 5
26