Skip to main content
3 of 3
added 93 characters in body
Uwe Heim
  • 28.5k
  • 20
  • 121
  • 287

Is User Interface API accessible via JS from a Helper of a Lightning Component?

Can we use the UI API in Lightning Components directly from within a Helper JS?

https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_get_started.htm

I've just read the docs and found no example for a Lightning use case. Maybe I've only missed it.

Can anyone point me to an existing example? Or provide a short answer if not feasible or not officially supported.

I haven't tried it so far, but it's GET-based design lets me suspect challenges with LockerService, XSS, CORS, CSP and whatever else is around there to protect us against bad guys and also against ourselves. Might Oauth be tricky? Can I use the Session ID instead Oauth?

For me it looks like it's not designed to be used from within lightning components JS. But it would help me a lot to have Information dynamically in the JS-layer like picklist values, layouts, etc. to create very dynamic LCs.

As a workaround I can imagine that it's accessible via APEX. But I don't like that way and also I suspected the user to need high privileges. For a read-access I would like very low privileged users to get information about their available picklist values, etc. realtime, on the fly, freshly requested on any impression of my LC. Maybe the API-access would also have a tick against Limits on every use?

Or is there a better alternative to get all that good stuff in LC's JS?

Uwe Heim
  • 28.5k
  • 20
  • 121
  • 287