6

I have a salesforce community site, and it is built off mostly visual force pages and apex classes. I would like to move the 'application' into sfdx. I am able to, with a little coaxing, deploy the classes, packages... etc to my scratch orgs. But not the community itself or any of the community configs through sfdx.

My main objective is to be able to standup a scratch org with my app automatically.

2
  • I'm being Mr Obvious here, but... have you added the right features in the scratch org? I'm looking at you, Communities... – catalandres Apr 13 '18 at 21:45
  • 1
    Did you deploy "CommunityTemplate" and "Network" metadata? – steals Apr 14 '18 at 6:47
0

I believe this is possible with shape-based Scratch orgs.. and as the comments stated, you need to have "features":["Communities",...] declared in your project-scratch-def.json

I have a multi-layered (multiple packageDirectories) sfdx-project.json that is deploying to my shape-based Scratch org

sfdx progress bars from my VS Code

The last progress bar shown in the screenshot is the communities portion of my metadata (I'm getting 1 error related to my siteDotComSites/My_Corporate_Portal1.site file)

So, I've deployed this specific packageDirectory directly to another sandbox with zero errors (so that's almost an answer to your original question) and hopefully will get this totally licked before the day is over and will update my answer.


UPDATE


I don't believe I can deploy the production .site file I spoke of above (if it's in production) so I marked it (and the .site-meta.xml) in my .forceignore. I have a similar one I use in sandbox and scratch orgs that seems to deploy just fine. So, with that wrapped up, my communities metadata is deployable to a scratch org (immediately after deployment I get welcome emails, and the whole nine-yards)

You may need to also pull down your email templates. I used the manifest/package.xml to right-click and retrieve source from my production org

This is what I used to get my templates to come down:

<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>unfiled$public/CommunityWelcomeEmailTemplate</members>
        <members>unfiled$public/CommunityForgotPasswordEmailTemplate</members>
        <members>unfiled$public/CommunityChangePasswordEmailTemplate</members>
        <name>EmailTemplate</name>
    </types>
    <version>51.0</version>
</Package>

If you have a logo or site footer graphic, you may have to pull that into your contentassets directory. This may work in manifest/package.xml...

<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <name>ContentAsset</name>
    </types>
    <version>51.0</version>
</Package>

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.