Skip to content

Unknown user permission: CreateAuditFields

Detection

Examples

  • Error Admin Unknown user permission: CreateAuditFields

Resolution

The "Set Audit Fields upon Record Creation" feature is not enabled in the target org.
- Enable it in the target org: Setup -> User Interface -> "Enable Set Audit Fields upon Record Creation and Update Records with Inactive Owners"
- The built-in replacement rule builtin-unknown-user-permissions removes the user permissions the target org does not have: check it is on (https://sfdx-hardis.cloudity.com/salesforce-devops-config-replacement-rules-builtin/)
- The manual deployment action below reminds to do it in each org of the pipeline, with a checkbox in the Pull Request comments

Deployment action

A deployment action can solve this error. Create it on the Pull Request of the current branch:

sf hardis:project:action:create --agent --scope pr --pr-id current --when pre-deploy --type manual --label "Enable Set Audit Fields upon Record Creation" --instructions "1. Open Setup, type User Interface in the Quick Find box, and open User Interface
2. Check \"Enable Set Audit Fields upon Record Creation and Update Records with Inactive Owners\", then Save
3. If it is already checked, there is nothing to do"

Documentation: https://sfdx-hardis.cloudity.com/salesforce-devops-work-on-user-story-deployment-actions-manual/

Comments