Out of the box, Salesforce doesn’t provide an a way to rename a Salesforce Lightning Component (Aura), but don’t worry there is an easier way than creating a new one and copying everything over.
Previously, we would do all of the following steps:
- create a new component named what we want it to be and then copy in all of our code.
- update everywhere to use the new component
- we would open up the Developer Console -> File -> and then click delete for the component
- Test and make sure everything is still working.
We can now instead do this:
- In the developer console or wherever we can run and update SOQL run this query: SELECT Id, DeveloperName, MasterLabel FROM AuraDefinitionBundle
- Update the correct record’s “DeveloperName” to be what you want it to be. Click Save Rows or Update Record.
- Test and make sure everything is still working.