Skip to content

Support Namespaced custom fields and Object in field history tracking#737

Merged
amtrack merged 2 commits intoamtrack:mainfrom
jrupesh:release
Mar 6, 2026
Merged

Support Namespaced custom fields and Object in field history tracking#737
amtrack merged 2 commits intoamtrack:mainfrom
jrupesh:release

Conversation

@jrupesh
Copy link
Copy Markdown
Contributor

@jrupesh jrupesh commented Feb 22, 2026

Pull Request: Support Field History Tracking for Packaged Person Account Fields

Summary

This PR enables Field History Tracking for custom fields on the Contact object that are added via managed packages and surfaced on Person Accounts.


Context & Problem

In Salesforce, when Person Accounts are enabled, the Contact object stores field details:

  1. Metadata Restrictions: Custom fields added to the Contact object often cannot have history tracking enabled via standard deployment if they are intended for Person Accounts.
  2. Package Limitations: Historically, fields belonging to managed packages have restricted the ability to enable history tracking on Person Account.

Changes

This implementation provides the necessary logic to toggle history tracking on for these specific field types originating from the package itself.

Key Enhancements:

Allows the following definitions to enable field history tracking,

        "historyTracking": [{
            "objectApiName": "Account",
            "enableHistoryTracking": true,
            "fieldHistoryTracking": [
              {
                "fieldApiName": "myNamespace__PreferredName__pc",
                "enableHistoryTracking": true
              },
              {
                "fieldApiName": "myNamespace__SingleNameOnly__pc",
                "enableHistoryTracking": true
              },
            ]

@amtrack
Copy link
Copy Markdown
Owner

amtrack commented Feb 27, 2026

@jrupesh Is this ready for review?

@jrupesh
Copy link
Copy Markdown
Contributor Author

jrupesh commented Feb 28, 2026

@jrupesh Is this ready for review?

Yes!

@amtrack
Copy link
Copy Markdown
Owner

amtrack commented Mar 3, 2026

I'm trying to test this.

@amtrack
Copy link
Copy Markdown
Owner

amtrack commented Mar 3, 2026

My manual testing failed:

Install a managed package from AppExchange (https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000FKArSUAX):

sf package install -p 04t0b000001XxRDAA0 --wait 30

Create a config file history-tracking-namespace.json:

{
  "settings": {
    "historyTracking": [
      {
        "objectApiName": "lightningbuddy__Actions__c",
        "enableHistoryTracking": true,
        "fieldHistoryTracking": [
          {
            "fieldApiName": "lightningbuddy__Docked_Display__c",
            "enableHistoryTracking": true
          }
        ]
      }
    ]
  }
}

And run:

./bin/run browserforce apply -f history-tracking-namespace.json

Output:

logging in... done
Applying config file history-tracking-namespace.json to org test-diqo55spjoge@example.com
 ›   Warning: retrying 6 more time(s) because of "Error: Insufficient Privileges
 ›   You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your 
 ›   administrator if access is necessary."
 ›   Warning: retrying 5 more time(s) because of "Error: Insufficient Privileges
 ›   You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your 
 ›   administrator if access is necessary."
[HistoryTracking] retrieving state... 
...

@jrupesh
Copy link
Copy Markdown
Contributor Author

jrupesh commented Mar 4, 2026

My manual testing failed:

Ah understood your approach, You cannot modify the managed package's field history.
Probably missed in my PR description.

This implementation is done for handling Custom field added through package for Person Accounts.
Enabling field history on person account fields is not supported from metadata API.

@amtrack amtrack merged commit 770cee4 into amtrack:main Mar 6, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 6, 2026

🎉 This PR is included in version 6.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@jrupesh jrupesh deleted the release branch April 11, 2026 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants