4

How can I get all page layouts from an org in Source Format?

Some things I've tried

# Retrieve

$ sfdx force:source:retrieve -m "Layout"
$ sfdx force:source:retrieve -m "Layout:My_Object__c"
$ sfdx force:source:retrieve -m "Layout:My_Object__c-My Object Layout"

=== Retrieved Source
No results found
# Converting from Metadata Format

# Given these files:
unpackaged/package.xml
unpackaged/layouts/My_Object__c-My Object Layout.layout

$ sfdx force:mdapi:convert --rootdir unpackaged --outputdir src
No results found

Manual steps are ok, just need to do this one-time.

4

I also tried the below commands and it worked fine.

sfdx force:source:retrieve -x ./manifest/package.xml

OR

sfdx force:source:retrieve -m Layout

You may like to verify if you have the Layout attribute added in your package.xml


This has worked for me in VS Code, if at all you are open to this option.

  • Create a Project with Manifest
  • In the package.xml, specify the layouts (make sure you have it in package.xml), example as below:

    <types>
        <members>*</members>
        <name>Layout</name>
    </types>
    
  • Execute SFDX: Retrieve Source in Manifest from Org enter image description here

1
  • sfdx force:source:retrieve -m Layout worked well for me. I was only interested in Account layouts, so I simply deleted the others. Jan 27 '20 at 21:02
4

Retrieving specific layout:

sfdx force:source:retrieve -m "Layout:Account-Retail Account"
  • Object Name: Account
  • Layout Name: Retail Account
1
  • I forget that dash way too often because they use dot notation in other places for seperate things Jun 5 '20 at 17:44
0

Layouts were ignored in .forceignore

-1

Edit (answer before retrieved record type rather than page layout as pointed out by David Cheng):
Retrieving specific page layout into project (VS code SF CLI):
sfdx force:source:retrieve -m "Layout:sobject-pagelayoutname"

Example:
Page Layout Name: Equipment Finance
Object: Opportunity

To retrieve the above:

sfdx force:source:retrieve -m "Layout:Opportunity-Equipment Finance"
1
  • 1
    Your example retrieves the record type, not the layout. Jul 9 at 23:52

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.