Does anyone know an easy way to identify the org settings and features required for package components? And does anyone have general advice for troubleshooting package version create errors?
I've been trying to create an unlocked package with components that require custom campaign influence, and it took a long time for me to figure out that I needed to add the appropriate setting in my definition file (scratch org config file): "campaignSettings: {"enableCampaignInfluence2": true}.
I was able to create the first package version successfully, but now I'm getting errors on the version create again. The only thing I changed was adding reports and dashboards based on the CustomizableCampaignInfluence report type, which is a standard report type that gets generated when the custom campaign influence is enabled.
"ERROR running force:package:version:create: MultiTouchCampaignAttribution/Campaigns_Responses_Timeline_32e: ReportType: CustomizableCampaignInfluence is not available,MultiTouchCampaignAttribution/Revenue_by_Opportunity_Type_nhZ: ReportType: CustomizableCampaignInfluence is not available,MultiTouchAttributionDashboards/caDFoKVGnLTwriPidsJZVCMKlDyojs: In field: report - no Report named MultiTouchCampaignAttributionReports/Campaigns_Responses_Timeline_32e found,MultiTouchCampaignAttribution/Top_Campaigns_SB1: ReportType: CustomizableCampaignInfluence is not available"
Is there another org setting or feature I need to add to the definition file? I can't add this report type to the package because it's standard. I tried adding a custom report type that uses the campaign influence object instead, but that didn't work either.
I noticed that when I create a new scratch org with that config file, I can't access campaign influence records until I assign my user the Sales Cloud User or CRM user permision set. I tried including this in that config file,
"features": ["SalesUser"]
but that just adds the Sales Cloud User permission set to the org, not assign it to my user. Maybe the package version create fails because no user in the scratch org can access the campaign influence object until that permission set is assigned. Do I need to create a script or something to automate the permission set assignment during the scratch org creation process?
Joe, there's a separate community group focused on unlocked packages. I recommend hopping over there. I've found great advice there.