39 votes
Accepted

Getting Session ID in Lightning

So, as it turns outs there is no way of getting a valid API-capable Session Id from lightning component, here is a quote from the partner discussion forums: Three things: There's no $Api global ...
Jose's user avatar
  • 2,132
15 votes
Accepted

Deploy Metadata from Non-Certified Package Versions via Apex - what does it mean

I believe this applies to the direct Apex access to parts of the Metadata API. My impression is it prevents any old random installed package from using the new functionality to then deploy further ...
Daniel Ballinger's user avatar
13 votes
Accepted

Deploy Flexipage Assignments

Flexipage Assignments are called ProfileOverride. It is documented here The metadata looks like the one below, it is a part of a Custom App: <CustomApplication xmlns="http://soap.sforce.com/...
Mohith Shrivastava's user avatar
13 votes
Accepted

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

This is a very similar scenario to what is occurring in Tooling API in Apex - polymorphism, generic query() callout? and is caused by an underlying limitation in Wsdl2Apex and WebServiceCallout.invoke(...
Daniel Ballinger's user avatar
12 votes

Getting Session ID in Lightning

There is a Salesforce-accepted way to do this. Use a Named Credential along with a Connected App and Auth Provider (which will be Salesforce). The Named Credential will be used as your endpoint ...
womanwhodevs's user avatar
12 votes
Accepted

Failed to retrieve related layout via metadata namespace

You don't include the "extension", but instead specify it exactly as you would in package.xml: Metadata.layout attachmentLayout = new Metadata.layout(); List<String> layoutList = new List<...
sfdcfox's user avatar
  • 490k
12 votes
Accepted

Querying metadata - Find Custom fields created today

Interestingly enough, I discovered this yesterday. Open your Developer Console, click on the Query Editor tab, click the "Use Tooling API" checkbox, then query away! SELECT DeveloperName, ...
sfdcfox's user avatar
  • 490k
12 votes
Accepted

Is there an API that returns consolidated metadata including layouts?

I think you might be referring to the brand-spanking-new UI API. https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_get_started.htm User Interface API enables you to create ...
Charles T's user avatar
  • 11k
12 votes
Accepted

SFDX: How to retrieve the active, but not the newest version of a Flow?

Ok, found the solution. The Flow Metadata Documentation says: To deploy or retrieve a version, you can specify the version number. For example, sampleFlow-3 specifies version 3 of the flow whose ...
Przemysław Długoszewski-Tamoń's user avatar
11 votes
Accepted

Deploying community from Sandbox to production

The deployment of communities if they are based on a Template its little different than normally how you deploy them . Here are some of key learnings Deploy all metadata as you normally do ,but pay ...
Mohith Shrivastava's user avatar
11 votes
Accepted

Opportunity StageName metadata retrieve in API 39

there is a dedicated metadata for such standard picklist field StandardValueSet mappings between field names and standardvalueset names can be explored here so to retrieve/deploy Opportunity....
Oleksandr Berehovskyi's user avatar
11 votes
Accepted

Error: “Picklist value in picklist not found” Opportunity Stage - Sales Process

you need to include StandardValueSet to your package.xml. to deploy custom values to Opportunity.StageName field use next lines: <types> <members>OpportunityStage</members> ...
Oleksandr Berehovskyi's user avatar
11 votes

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

Taken from Issue # 225 on their repo. Error occurred when obtaining a custom picklist fields CustomValue. Error: System.CalloutException: Web service callout failed: Unable to find apex schema ...
battery.cord's user avatar
  • 8,825
11 votes

How do I retrieve a flow and associated metadata from an org?

before retrieve and push the flows , you have to connect source org and target org from vscode using cli commands. then use below commands. retrieve the flow from source org by using below command: ...
sdandamud1's user avatar
  • 2,705
11 votes

Cannot find the declaration of element

I was able to figure out Here is what you would do Go to VS Code: Code => Preference => Settings => (search for) Validation ==> Click on XML (from the left Nav) and Uncheck "...
Nick's user avatar
  • 7,012
11 votes

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

This feature seems extremely finicky. I noticed that the XML metadata API deployment was NOT correctly populating the data (You can verify with the SOQL query below.) I managed to get it working ...
sfdx wolf's user avatar
  • 180
10 votes

Updating an object API name when referenced by code - impossible!

I think developers just become resigned to how painful simple refactoring like changing a name is after a while, either accepting the pain involved or choosing to just leave the bad name. Or choosing ...
Keith C's user avatar
  • 136k
10 votes
Accepted

Can OWD be imported/exported as metadata?

Yes. Each object has two fields, "sharingModel" and "externalSharingModel". You can import and export these values between orgs. You'll find this setting in the CustomObject metadata. I personally use ...
sfdcfox's user avatar
  • 490k
10 votes

SFDX: where can set Field-level security and accessibility?

It's in profiles/[ProfileName].profile-meta.xml, just as it would be in the Metadata API. You need to make sure you push/pull profiles in order to get field security. You can also do so by way of the ...
sfdcfox's user avatar
  • 490k
10 votes

Summer 22 v55.0 Flow Deployment Error

The regionContainerType field of the FlowScreenField metadata component was introduced in API version 55.0. Although it is not documented, when the component type is a Section this field is required. ...
Oleh Berehovskyi's user avatar
9 votes
Accepted

How to fetch a layout from metadata API in apex under a name prefix

The pagelayout follow below naming conventions for managed package for a packaged layout over a standard object you need to retrieve <Object Name>-<namespace>__<Layout Name> and ...
Mohith Shrivastava's user avatar
9 votes
Accepted

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

The below folder structure and file extensions worked for me Notice I have prefixed the file with the name .platformEventSubscriberConfig I used the command below sfdx force:mdapi:deploy -d ./src --...
Mohith Shrivastava's user avatar
8 votes

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

Found the most easiest way to get package name and version numbers. SELECT DurableId, Id, IsSalesforce,MajorVersion,MinorVersion, Name,NamespacePrefix FROM Publisher Now its clear that we can ...
AtulRajguru9's user avatar
  • 9,120
8 votes
Accepted

GlobalPicklist no longer a valid MetaData type in 38.0?

Yes, GlobalPicklist has been replaced by GlobalValueSet. This is outlined in the relevant documentation and was mentioned in the release notes. Streamlined Metadata API for Picklists We bring you ...
sfdcfox's user avatar
  • 490k
8 votes

How can I get better diffs when looking at Salesforce metadata

This answer is relevant to Salesforce metadata and also to anyone dealing with large blocks of XML or similar repetitive text. When working with large files in version control, especially large XML ...
abd3721's user avatar
  • 2,152
8 votes
Accepted

Impossible to test Metadata.Operations.enqueueDeployment method

You might use Test.isRunningTest(). It is considered to be a bad practice to use it but for covering this case this is the only option for now. Hopefully in the future Salesforce will add some Deploy ...
Patlatus's user avatar
  • 16.7k
8 votes
Accepted

How to list all the metadata that is changed after a given date

For objects supported by Tooling API, you can simply write a query for this. Open the Developer Console, click on the Query tab, enter the Tooling API query, and check the "Use Tooling API" checkbox. ...
sfdcfox's user avatar
  • 490k
8 votes
Accepted

Is it possible to programmatically change connectedApp settings in production?

In short, yes, you're on a fool's errand. The general rule is that you can't package any settings that would allow granting 'system' permissions. That is, permissions that affect more than just the ...
daveespo's user avatar
  • 2,603
8 votes
Accepted

Why does VS Code's Org Browser retrieves metadata with different file extensions than Metadata API and what are possible consequences of that?

With the introduction of SFDX, we also got a new representation for the metadata/code known as "Source form". This is different from the traditional representation, which is called "Metadata API form"...
Derek F's user avatar
  • 61.5k
8 votes

Cannot find the declaration of element

The posted answers helped me to discover what I believe to be an even better answer. Instead of disabling all XML Validation wholesale, there is a setting for Xml -> Validation -> Schema: ...
DanTheMan's user avatar
  • 171

Only top scored, non community-wiki answers of a minimum length are eligible