My company is in the final stages of a project where we developed (using DX but 1st generation packaging) a managed package for the customer. This week is the first time we’re actually packaging it up for installation.
I created a packaging org with a throwaway namespace – e.g. our initials, our customer’s initials, and “1”. I did this in order to “be able to make the first-timer mistakes” without risk, and I think I just made my first.
We have a handful of protected Custom Metadata records that exist in order to give unit test coverage but remain hidden from the end-user. After creating our first “released” version (not actually a version we are releasing), I wanted to see what it would allow us to remove from future versions of the app. So I picked one of the Custom Metadata records. But I accidentally deleted it from the org entirely rather than removing it from the package.
The net result was that it continued to appear as a component in the package but with a blank name linking to nowhere. I could not find any way to undelete the record. And I could not recreate a record with the same API name because that’s how packaging orgs work. It allowed me to remove the blank component but it never appeared in the Deleted tab after.
Is there anything I could have done after that deletion to restore the CM record for the next package release? Or have I just run into one of those “permanent pitfalls every vendor needs to know”? Time to create throwaway namespace #2?
Assuming you have not yet uploaded a new version, you can follow the steps in Viewing Deleted Components:
To access the Deleted Package Components page, from Setup, enter Packages in the Quick Find box, then select Packages. Select the package that the component was uploaded to, and then click View Deleted Components. If a component can be retrieved through the Recycle Bin, it can also be retrieved through this page.
You can retrieve components from the Recycle Bin and Deleted Package Components page any time before uploading a new version of the package. To do this, click Undelete next to the component.
If you’ve already uploaded a new version, then you’re probably out of luck. In addition, that type may not be supported for undeletion (it’s not in the list, but I can’t confirm this). If you’ve already uploaded a new version, you still might be able to fix it, but it will require support from Partner Support to right it, so it may also be worth it to submit a case through the Partner Portal to see if they can fix it.