I'm trying to create an unlocked package that uses an Apex trigger to create campaign influence records for a custom campaign influence model. I keep running into errors that seem to be caused by the Apex trigger that creates the campaign influence records.
I used a playground org to develop the Apex trigger as well as the other components for the package (Apex test class, custom campaign influence model record, permission sets...). I tried to add the trigger to an unmanaged package so I could retrieve it with sfdx, but the trigger was not visible when I was trying to add it as a package component. I could add everything else to the package, including the test class for the trigger.
I was able to retrieve the Apex trigger separately without adding it to the package, but now when I try to create the first unlocked package version with sfdx, I'm getting this error:
"Multi_Touch_Campaign_Model: Not available for deploy for this organization, CampaignInfluenceRecordCreationTest: Invalid type: CampaignInfluence,.."
My playground org has dev hub, unlocked packages, and campaign influence enabled. My apex api version is 48. I'm relatively new to developing in SF, but I can't find any similar scenario online.
I guess I should add that the Apex trigger works fine along with the other components I developed for this package in the trailhead playground.