10

Assume a whole lot of Lightning Components - some of them in use on Flexipages, some in use on Visualforce and some not in use at all.

Is there anything better than (foreach!) create a new Component with the desired name, copy everything manually from markup, controller, helper, style, docu, renderer, design, svg and than eventually delete the old one?

11

You can use dataloader and update records in the table "AuraDefinationBundle" .The developerName is the field that needs to be updated.

Please note you need dataloader or workbench since the object is not accessible via apex

  • I'm getting an obscure FIELD_INTEGRITY_EXCEPTION error when I try to update just the DeveloperName of an AuraDefinitionBundle in API v40.0. To make sure the field name doesn't break any of the name field rules, I just deleted one of letters from the DeveloperName - same error. Anyone else have this issue? – Brent Bow Oct 26 '17 at 20:10
  • 1
    @<Mohith Shrivastava> read your article about this, but I get an [object Object]: An unexpected error occurred. Please include this ErrorId if you contact support: 624622357-2036 (444998763) when trying to save the query change – smohyee Oct 17 '18 at 16:31
2

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

0

I use SFDX in my company, and the best way that I found to rename a component is by following the below steps: eg.

Previous name = MyLazyName

Renamed to = MyActiveName

  1. In your IDE find all the places where MyLazyName occurs. (child comps, action overrides, Layouts, flexi pages)
  2. Go to your (browser)scratch org, and remove all of the references of this component. (Not by IDE or sfdx:force:source:push)
  3. In your folder system, go to force-app/main/default/aura/MyLazyName Rename all sub components to MyActiveName.cmp, MyActiveNameController.js, etc.
  4. Also in your IDE, replace all references found in point 2, to MyActiveName. (eg. c:MyActiveName)

  5. Do sfdx:force:source:push.

  6. If it is successful, verify that things still work good.

  7. From the remote scratch org, go to Dev Console > Open MyLazyName (if not yet deleted) > File -> Delete

  8. Take a sfdx force:source:pull

All the best.!

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.