sfdx force:source:delete does not work on production orgs
See original GitHub issueforce:source:delete fails and wouldn’t run on production orgs.
Steps to Reproduce:
- Connect to any production org and attempt to delete any metadata (in this case attempting to delete a custom field)
sfdx force:source:delete -m "CustomField:testobject__c.Admin_Badges__c"
throws error: { “status”: 1, “name”: “sf:INVALID_OPERATION”, “message”: “INVALID_OPERATION: testLevel of NoTestRun cannot be used in production organizations”, “exitCode”: 1, “commandName”: “SourceDeleteCommand” }
- As above command failed with testLevel missing error, try providing testlevel and attempt the delete
sfdx force:source:delete -m "CustomField:trailheadapp__Trailhead_User_Data__c.Admin_Badges__c" -l RunLocalTests
throws error: { “status”: 1, “name”: “Error”, “message”: “Unexpected arguments: -l, RunLocalTests\nSee more help with --help”, “exitCode”: 1, “commandName”: “SourceDeleteCommand”, “stack”: "Error: Unexpected arguments: -l, RunLocalTests }
tried other possibilities with --checkonly flag etc… but none help. tried with latest and greatest cli & plugin version.
Couple other notes:
- The documentation from Salesforce is very Vague around this and needs correction as well. It doesn’t clearly state whether this is designed to work for production orgs or not.
- This command should also take manifest file (package.xml/destructivechanges.xml) to have scalable way to list components to delete. currently it seem like designed to accept only comma separated metadata components which is not viable.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:8 (2 by maintainers)
This was fixed in latest v7.120.0, release notes: https://github.com/forcedotcom/cli/tree/main/releasenotes#71200-sept-30-2021
@fransf-wtax - We first want to promote the source plugin to the production CLI core plugins. Once that work is complete the next scheduled work will be to add the source delete command to it, but also to support destructive changes as part of a source:deploy. My guess is it will be delivered in late July or early August.