function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
David PattisonDavid Pattison 

Can unlocked packages include standard fields?

Hi all,
I tried to add some Case Standard fields into my unlocked package, merely to enable history tracking on the fields. For example, the Type and Description field. I got no errors creating the package. However, installing the package didn't seem to enable the history tracking. Is this even supported? 
Best Answer chosen by David Pattison
AnudeepAnudeep (Salesforce Developers) 
Hi David, 

I have checked internally and learned from our Senior Director, Product Management that Standard fields cannot be packaged in unlocked packages

I haven't been able to find this documented anywhere myself but I suggest raising an Idea on the IdeaExhchange platform

If you find this information helpful, I appreciate it if you can mark this answer as Best so that others facing the same issue might find this useful

 

All Answers

AnudeepAnudeep (Salesforce Developers) 
Hi David, 

The metadata coverage report is the source of truth for metadata supported in unlocked packages. While the vision is to provide metadata API support for all Salesforce Metadata and enable everything to be packaged in an unlocked package, it is going to take a while to get there, and the metadata coverage report will track the progress. Having said this, singletons (things that have only one instance of them in an org) like org settings and preferences, and metadata without top-level ids (E.g.: Standard Value Sets) are NOT packageable in unlocked packages.

There have been known Issues around this particularly to show a warning message when an attempt is made to include such fields

https://trailblazer.salesforce.com/issues_view?Id=a1p3A000001SHEU

package:install does NOT enable history tracking on Contact object, nor on a Custom Field. The above-known issue describes that

Let me know if this helps, if it does, please mark this answer as best so that others facing the same issue will find this information useful. Thank you
 
David PattisonDavid Pattison
Thankyou Anudeep, but the metadata coverage support simply says that "CustomField" IS supported in unlocked packages. Despite these fields being standard such a change still is represented as a 'CustomField'. Is this limitation actually documented anywhere? I did already see the issue you mentioned above but, still, this does not mention any reason why there should be a warning.
AnudeepAnudeep (Salesforce Developers) 
Hi David, 

I have checked internally and learned from our Senior Director, Product Management that Standard fields cannot be packaged in unlocked packages

I haven't been able to find this documented anywhere myself but I suggest raising an Idea on the IdeaExhchange platform

If you find this information helpful, I appreciate it if you can mark this answer as Best so that others facing the same issue might find this useful

 
This was selected as the best answer