1

I'm trying to create 2nd gen unlocked package version for a Trigger framework which is custom metadata driven. Every time I try to generate a version i'm getting error that custom fields in metadata types object doesn't exists because of which it also throws error related to dependent class invalid

    Multiple errors occurred:
    (1) MyTestClass: Field does not exist: AD__r on metadata_type__mdt
    (2) MyTestClass: Field does not exist: AD__c on metadata_type__mdt
    (3) MyTestClass: Field does not exist: Order__c on metadata_type__mdt
  (117) MyClassFlowClearBypass: Dependent class is invalid and needs recompilation:
 Class MyTriggerHandler : Variable does not exist: Before_Update__c
5
  • Did you actually include those fields in the Unlocked Package?
    – sfdcfox
    Oct 20, 2022 at 20:40
  • @sfdcfox yes, I have included all the fields and metadata type objects in the package. I'm successfully able to deploy my branch into a scratch org but not able to generate package version
    – Maverick
    Oct 20, 2022 at 20:42
  • I'd double-check that. It's easy enough to forget to include the files in the repo. It doesn't matter if they're in the Scratch Org, because the repo/local files are the source of truth. Try sfdx force:source:pull.
    – sfdcfox
    Oct 20, 2022 at 20:44
  • Any resolution to this? I am getting this now. Can also push to scratch org fine but cannot create a package version. Tried pulling down what was pushed to the scratch org but that did not alleviate the issue. Any suggestions? Nov 7, 2022 at 16:24
  • 2
    @MichaelSchirger I ended up deleting the package id and generated a new package id which resolved the issue.
    – Maverick
    Nov 9, 2022 at 19:01

1 Answer 1

0

Try rename the package folder and update the path setting in packageDirectories, it works for me, not sure why tho

You must log in to answer this question.

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