Retrieving Permission Set with RetainFieldHistory User Permission In Org Doesn't Include Permission
- Dominant language
- No language data
- Stars
- 571
- Forks
- 80
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 3
Description
### Summary
I try to retrieve a permission set from my org.
- In the org, the permission set has RetainFieldHistory enabled
- When I retrieve it, the permission set metadata file doesn't include it.
- CLI command: `sf project retrieve start -m PermissionSet:sysadmin`
In contrast, the user permission is included, when I retrieve the standard System Administrator profile
`sf project retrieve start -m Profile:Admin`
### Steps To Reproduce
1. Have an org, where Shield's Field Audit Trail is enabled
2. Create a custom permission set
3. Enable the user permission `RetainFieldHistory`
4. Retrieve it via the CLI by running `sf project retrieve start -m PermissionSet:sysadmin`
> [!TIP]
> use `sf doctor --create-issue` to automatically fill the required information
### Expected result
Expected the permission set to include:
```
true
RetainFieldHistory
```
### Actual result
It didn't include the user permission, despite being set in the org.
### Additional information
### System Information
Which shell or terminal are you using? PS
```json
{
"architecture": "win32-x64",
"cliVersion": "@salesforce/cli/2.150.6",
"nodeVersion": "node-v24.19.0",
"osVersion": "Windows_NT 10.0.26200",
"rootPath": "C:\\Users\\ext-nto\\AppData\\Local\\sf\\client\\2.150.6-c049970",
"shell": "cmd.exe",
"pluginVersions": [
"@oclif/plugin-autocomplete 3.3.0 (core)",
"@oclif/plugin-commands 4.2.0 (core)",
"@oclif/plugin-help 6.3.0 (core)",
"@oclif/plugin-not-found 3.3.0 (core)",
"@oclif/plugin-plugins 5.5.1 (core)",
"@oclif/plugin-search 1.3.0 (core)",
"@oclif/plugin-update 4.8.0 (core)",
"@oclif/plugin-version 2.3.0 (core)",
"@oclif/plugin-warn-if-update-available 3.2.0 (core)",
"@oclif/plugin-which 3.3.0 (core)",
"@salesforce/cli 2.150.6 (core)",
"agent 2.0.5 (core)",
"apex 4.1.1 (core)",
"api 2.0.9 (core)",
"auth 5.0.6 (core)",
"code-analyzer 5.16.0 (user)",
"data 5.1.7 (core)",
"deploy-retrieve 4.1.2 (core)",
"info 4.0.9 (core)",
"limits 4.0.4 (core)",
"marketplace 2.0.5 (core)",
"org 6.0.11 (core)",
"packaging 3.0.6 (core)",
"schema 4.0.6 (core)",
"settings 3.0.6 (core)",
"sobject 2.0.5 (core)",
"telemetry 4.0.6 (core)",
"templates 57.0.11 (core)",
"trust 4.0.10 (core)",
"user 5.0.2 (core)",
"sfdx-git-delta 6.45.1 (user)"
]
}
```
Contributor guide
Research direction
Reproduce the issue with `sf project retrieve start -m PermissionSet:sysadmin` in an org where RetainFieldHistory is enabled, then compare the retrieved PermissionSet metadata with `sf project retrieve start -m Profile:Admin`. Trace the retrieval path for user permissions and verify that the generated PermissionSet metadata includes the expected enabled RetainFieldHistory entry.
Written by the indexing model from the issue text.
Assessment
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100