4

I have two queries Is there only one way to delete lightning Component? that is Dev Console File--> Delete

How To Rename Lightning Component?

9

Update:

You can also query for the AuraDefinitionBundle from developer console and simply change the DeveloperName

The other way to do this via ANT migration tool .You will create a destructive xml like below

destructiveChanges.xml

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
    <members>page</members>
    <members>example</members>
    <name>AuraDefinitionBundle</name>
</types>
<version>37.0</version>

and then an empty package.xml

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<version>37.0</version>
</Package>

Use ANT to build this and this would destroy the component bundle mentioned in the destrutiveChanges xml

Renaming Currently is pain ,I prefer recreating a new component and copy paste it and delete older via dev console .Using tools like ANT or force.com CLI is quicker .

5
  • Why renaming is not allowed. any idea? – SFDC shaikh Aug 3 '16 at 16:45
  • Its possible from metadata currently I believe and not tested .So the problem is you will have to rename everything since bundle may comprise of different files . – Mohith Shrivastava Aug 3 '16 at 16:48
  • that is weired. Salesforce should allow renaming lightning components. Lets put idea in community :) – SFDC shaikh Aug 3 '16 at 16:50
  • 1
    idea posted to community hope they will look into this success.salesforce.com/ideaView?id=0873A000000cLiqQAE – SFDC shaikh Aug 3 '16 at 16:56
  • Easiest way for Admins I found was to use the workbench – Christian Szandor Knapp Jul 31 '17 at 13:42
3

We can run below query in developer console query editor. It will return all the aura component name in DeveloperName column.

SELECT Id, DeveloperName FROM AuraDefinitionBundle

Now we can edit Developer Name and save it. It will reflect all the place wherever the component is used. If you are using the component in controller and helper, It will reflect there also.

1
1

I just ran through this issue and found that renaming the files in a lightning component, plus all the controllers, is a huge pain. Especially if you are creating a managed package.

What I found to be the easiest was to provide a new label for the component via the design file. This will change the name presented in the UI and requires no file name or metadata changes.

MyPoorlyNamedComponent/MyPoorlyNamedComponent.design

<design:component label="A Better Name">
</design:component>

Lightning Component Bundle Design Resources

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.