I'm checking this on a Spring'19 v45 Sandbox in Execute Anonymous:

[ select Id from AuraDefinitionBundle ]       // ==> works fine!
[ select Id from AuraDefinition ]             // ==> flawless!

I would have strongly expected, that the new LWC will be mapped as the same way as Aura, Apex, Visualforce and StaticResources are mapped into the database. Just as a consistent behavior of the platform. But as a great unfortunate, those lines do FAIL:

[ select Id from LightningComponentBundle ]   // ==> Invalid type: Schema.LightningComponentBundle
[ select Id from LightningComponentResource ] // ==> Invalid type: Schema.LightningComponentResource


Is this just because the stuff is too NEW and not 100% completed or has Salesforce now decided against mirroring these Metadata into the database for good? Are we forced to use Metadata-api and Tooling-api just for reading these resources?? This would be not nice.

For sure, I would like to get LightningComponentBundle and LightningComponentResource mapped into the database.

Will this come later? Or am I doing something wrong?

  • If the query is run in Query Editor (with Use Tooling API selected), it works fine. But, if used within the context of Apex, the compiler fails to recognize LightningComponentBundle as a valid Schema type. This could be potentially a bug. – Jayant Das Jan 15 at 15:29
  • I've been making inquiries. Sounds like the Lightning team needs to turn on something to have LightningComponentBundle accessible from Apex. – Daniel Ballinger Jan 15 at 23:46
  • 2
    Can you share your use case so they have an idea about why you want it exposed? twitter.com/tahir_farhan/status/1085552623351156742?s=09 – Daniel Ballinger Jan 16 at 18:18

Via twitter, it sounds like they have added a work item to expose this functionality in a future release. https://twitter.com/tahir_farhan/status/1085939366764134401?s=09

Cool. Let us get to work on that. FYI, W-4277797 is the work number we are using to track. You can reference it in future conversations. Thanks
Farhan Tahir

  • Wow, that's super cool. Thanks a lot for your tweet. My use case is our native IDE CodeFusion where I always display a full tree of permanently updated metadata-items. No need of "refreshing" anything or checking if the server is updated. What exists is simply there. Always. Sure I could query via ToolingAPI, but a quick SOQL is simpler, faster, smarter and saves API-calls just for listing that stuff. A dream would be, when they make all these tables (including ApexClass, ApexPage, AuraDefinition, etc) also writable. Then we could write super powerfull editors, with just a few lines – Uwe Heim Jan 17 at 21:40
  • It looks like it was not a part of the spring release. Not sure on how to ask Farhan Tahir about the current status. Is there any way to get an update when this is done? Sorry, Daniel, to bother you with that. Unfortunately Fahran has neither commented nor answered here, so I don't know how to ask him directly... – Uwe Heim Feb 12 at 10:39
  • @UweHeim I'd have to go to someone on the Salesforce Eng team to see what the status of W-4277797 is (if they can share it publicly). Since it was only added a month ago I'd say it was too late to be added into the existing Spring 19 release which was already in Sandboxes at the time. It's likely a release (or two) away. – Daniel Ballinger Feb 12 at 23:08
  • @farhan-tahir Are you able to comment? – Daniel Ballinger Feb 12 at 23:10
  • @farhan-tahir is W-4277797 dead? I would need that very urgently... if it will never come, even that information will help me to plan ahead. – Uwe Heim Oct 8 at 12:01

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.