0

Goal: Our Org has multiple apps that I would like to extract each app into its own individual package. The goal is to retrieve this package to push to a scratch org and then make it an unlocked package.

Main Problem: I am unable to create a solid package or package.xml that would mimic a specific app and successfully push to a Scratch-Org.

Current progress: Currently I am using "package manager" to select the necessary items that the app requires, however, after retrieving and converting the package, I get a "Push failed" with a bunch of dependency errors while "pushing" to the Scratch-Org.

Questions:

1) What is the best way to create a managed/ unmanaged package or package.xml that will assure a successful full mimic of the targeted app?

2) Are there any decent articles or sources on how to successfully break apart multiple apps, which share resources in an org, into their own individual unlocked package?

0

1) What is the best way to create a managed/ unmanaged package or package.xml that will assure a successful full mimic of the targeted app?

The unmanaged package route should work. However, keep in mind that Scratch Orgs don't get "everything" by default, so you need to check the Scratch Org Definition File and Scratch Org Definition Configuration Values to see if you need to enable any extra features. The "View Dependencies" button on your package detail screen should identify any features that you must enable for a successful deploy. Packages automatically resolve dependencies, so if you're missing something from your push, it's a required feature.

2) Are there any decent articles or sources on how to successfully break apart multiple apps, which share resources in an org, into their own individual unlocked package?

I've never seen one, though I'm sure one must exist. I recently went through a process where I split our org in to chunks, but left some pieces out (it was a minimal migration). As it so happens, it's really just a matter of building dependencies.

How I would do it, given the requirements, would go along the lines of building a package for each app, converting the app from an XML file to a CSV file (via a script I'd write), import each CSV-ified app in to a MySQL database (my DB of choice, use whatever you like), and then run normal SQL queries to determine which values exist in duplicate in each table. Export those common duplicates, build it back in to an XML file, and there's your first package. Repeat as you build your dependencies.

In the future, we'll have MetadataComponentDependency, but at the time of this answer, it's still Pilot. Manual intervention is the best way, for now.

|improve this answer|||||
0

I really liked this Salesforce Developers Blog post series related to this. You probably want to start with a complete dx format project (all your apps from the org), make sure you can push that to a scratch org and then start separating the project into modules/packages. This way you can slowly start identifying overlaps and dependencies and resolve them while still being able to check "full" deployment works.

It'll be a long road, but worth the effort.

|improve this answer|||||

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.