I'm noticing that every time I spin up a new scratch org, I lose the page layout assignments I've specified for each of my Product2 recordtypes.

Is page layout assignment something that's supposed to be included in my SFDX project source? If so, does anybody have any ideas about why that isn't being pulled down when I do a force:source:pull? And if not, has anyone come up with any workarounds for this issue?

  • Did you pull the Profile object as well? If not, then that would be an expected behavior.
    – sfdcfox
    Dec 14 '17 at 23:22
  • I didn't think it was possible not to. I understood that force:source:pull is going to pull all the custom metadata in a scratch org regardless of type. Is there something specific I need to do to reference specific metadata types?
    – AGallinat
    Dec 14 '17 at 23:51
  • @AGallinat Did you find out how to get the layout assignment metadata?
    – cottog
    Jan 22 '19 at 14:14

For some reason, changing page layout assignments isn't detected by sfdx force:source:status or pull. I got the whole profile metadata using

sfdx force:source:retrieve -m Profile

Then snipped out everything except the layoutAssignments snippet(s) I wanted.

  • Any idea why both sfdx force:source:retrieve and sfdx force:mdapi:retrieve aren't giving me the layoutAssignments? Apr 6 at 1:02

I noticed that to get layout assignment you have to specify that you want to retrieve Profile, Layout, RecordType and CustomObject at the same time. You may also want to provide your_custom_object, like this:

sfdx force:source:retrieve -m Profile,Layout,RecordType,CustomObject:your_custom_object

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.