0

I use this command

sfdx force:source:deploy -p ./foundation/,./sales,./marketing -c

because I have my metadata organized in 3 different folders. When I run this command, the Salesforce Cli does 3 separate validation deployments. First foundation, then sales, then marketing. Where I'm running into problems is ./foundation has metadata in it that ./sales needs to pass validation. My guess is because ./foundation was only validated and never deployed, ./sales doesn't see the metadata in the org for when it attempts to validate.

Is there a way to validate all the folders at once into one deployment?

Here is my sfdx-project.json

{
  "packageDirectories": [
      {
          "path": "foundation",
          "default": true
      },
      {
           "path": "sales"
      },      
      {
          "path": "marketing"
      }
  ],
  "namespace": "",
  "sfdcLoginUrl": "https://login.salesforce.com",
  "sourceApiVersion": "51.0"
}
1
  • Are the any common components? If not then does writing a script to combine the directories in temp folder and validate that suits your use case.
    – manjit5190
    May 20 at 20:08
0

You can Specify Unpackaged Metadata for deployment purposes, but, as far as I can tell, you can't specify multiple paths. As long as you only need one dependency, it should be fine to write it as such. It's probably better to just create new versions as you go along, because you can always deprecate/delete package versions. They're not permanent in any real sense. That's what dependencies were made for.


  "packageDirectories": [
      {
          "path": "foundation",
          "default": true
      },
      {
           "path": "sales",
           "dependencies": [
                { "package": "foundation",
                  "versionNumber": "0.1.0.LATEST"
                }
            ]
      },      
      {
          "path": "marketing"
      }
  ],
  "namespace": "",
  "sfdcLoginUrl": "https://login.salesforce.com",
  "sourceApiVersion": "51.0"
}

  "packageDirectories": [
      {
          "path": "foundation",
          "default": true
      },
      {
           "path": "sales",
           "unpackagedMetadata": { 
               "path": "foundation" 
          }
      },      
      {
          "path": "marketing"
      }
  ],
  "namespace": "",
  "sfdcLoginUrl": "https://login.salesforce.com",
  "sourceApiVersion": "51.0"
}
2
  • I don't think one unpackaged directory can make another unpackaged directory a dependency. I just tried what you suggested and the deployment is failing
    – Tyler Zika
    May 20 at 5:15
  • @TylerZika Right, you would need to actually make a version of each package for dependencies. You should, however, be able to use one directory as a unpackaged metadata of another directory. Is there a reason why you're not creating packages?
    – sfdcfox
    May 20 at 11:54

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.