2

We are an OEM provider and therefore control both the package and the destination orgs. Our packaging org has 3 profiles and we add permissions to those 3 profiles when creating new components (fields, page layouts, etc.). When the customer org upgrades the package, there are three options available:

Install for Specific Profiles...

If we select the "Install for Specific Profiles..." and map the Access Level of the package's profiles to the destination org, this lets us control a bit what new components are granted and what permissions during the upgrade process.

Profile Mapping

Is there a way to automate this process from SFDX or some other CLI/API? As far as I can tell, SFDX only allows you to upgrade for All Users in a push upgrade, or you can use a pull upgrade and pick which option to install. But I can't find any documentation about how to do a pull upgrade from a command line while matching profiles. There must be some method since Salesforce allows it from this screen, but the only solution we've come up with is some UIFlow or process that logs into each org, navigates to the specific page and performs the mapping.

Anyone with any brilliant ideas out there?

2 Answers 2

3

You can do it from the Tooling API by creating a PackageInstallRequest record in the target org.

This object includes a field ProfileMappings that allows you to specify the source Profile name (in your managed package) and the target name of the Profile in the subscriber org to which it should be mapped.

This is not currently supported by SFDX, CumulusCI, or any other CLI with which I'm familiar, but it should be pretty straightforward to implement in a Python or Node script wrapped around SFDX or whatever authentication solution you're currently using to deliver your package.

0

I needed this as well, so I've just implemented an sfdx plugin with a patched package:install command: https://github.com/amtrack/sfdx-patches

sfdx patched:package:install allows passing a flag (--automapprofiles), so that profiles are automatically mapped based on their names.

If someone needs a mapping for different Profile names, I'd be willing to implement this, too.

Thanks to David Reed for mentioning the PackageInstallRequest here and thanks to Jeff for throwing light on the details of this object: How do I specify profile mappings on a PackageInstallRequest?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .