- edited description
Rename refactoring for SObjects/fields
A common (to me) use case is:
- Define custom object field Account.Foobar__c
- Add Apex code that references Foobar__c ... submit for PR ... uh-oh, learn that standard naming convention for org is that field should have been named
Account.Fubar__c
Now I would like IC2 to allow rename of the custom field and also automatically change the references in the Apex. I realize that there could be other references to the custom field that might be hard to change automatically (formula fields, WFR, Process Builder, ...) but for some use cases, just the field and apex refs would suffice for developer convenience (even before the PR when developer realized on day 1 field was named Foobar and on day 3 realized should have been named Fubar. )
Comments (7)
-
reporter -
If possible to implement, this would be amazing.
-
repo owner It's quite possible to implement, but it will be heavily decorated with caveats. First off, it would need to find ALL references to the field so they could be updated. Honestly that's not a huge issue as long all metadata that references the field is available locally during the rename operation. It would then update the field declaration and all references to have the new name and deploy that to the org, after which it would (perhaps optionally) deploy destructive changes to remove the original field name. The second major caveat, and this applies to all renames of top-level metadata including Apex classes and triggers today, is that this series of operations to update the org would only occur in the target org at the time that the rename took place. Staging those changes to other orgs would not be automatic. Salesforce DX might help with this given how
force:source:push
works, but for traditional orgs, removal of the original field would likely be a manual effort.There are other caveats, but I want to make sure that some of the known limitations--these being the big ones--are clearly stated here.
-
These restrictions make perfect sense, didn't expect it could be done in any other way personally.
-
repo owner - changed title to Rename refactoring for SObjects/fields
- removed version
- changed component to Refactoring
-
repo owner Issue
#1830was marked as a duplicate of this issue. -
repo owner Should also work for custom settings and custom metadata types and their fields.
- Log in to comment