How do i migrate pagelayout using ant.

These are the steps i followed

  1. Called sf:retrieve in Ant and specified the custom object name in package.xml
  2. Retrieved object definition does not have page layouts in it
  3. after the retrieve when i try to deploy,sf:deploy,can see no page layouts are getting deployed.

How do i do this?

I want to deploy pagelayouts for standard objects(Account,Contacts) and custom objects.


Your package.xml needs to include the "Layout" type. It is usually best to explicitly name the layouts where the syntax is objectname-layoutname e.g.:

    <members>Account-Claims Account Layout</members>
    <members>Contact-Claims Contact Layout</members>
    <members>MyCustomObject__c-MyCustomObject Layout</members>

PS package.xml is documented in detail in the Metadata API Developer’s Guide.

  • do i need to explicitly list out names...or is there a way to include all pagelayouts of an object in one go – sfdc99999 Oct 31 '14 at 8:22
  • 1
    This type does support the <members>*</members> wildcard but as orgs normally contain a lot of objects and so layouts that you are not interested in that wouldn't be too helpful. AFAIK you cannot wildcard part of a name; the documentation says "a wildcard character (*) in place of the model name". So I think you will be better off explicitly naming them. – Keith C Oct 31 '14 at 8:32

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.