I need to access the PageLayout NAME assigned for logged in user for a given Object or Record Id. This details needs to be fetched in Lightning component. I think due to security restrictions, Lightning doesn't allow sending HTTP request directly to fetch pageLayout assigned for the logged in user unless we create Connected App, Auth Providers and Named Credential. So I thought of using Metadata API. Is there a way to fetch it using Metadata API? Can I get a code snippet?
The API that is intended for this use case is the UI API, which provides support for getting user interface presentation information like the correct layout for a given record and user.
While it's possible to do so with the Metadata API, ordinary unprivileged users can't access the Metadata API at all - it's not easier to authenticate for MDAPI than UI API, it's harder.
Even granting the appropriate permissions, it would involve quite a bit of excess complexity to retrieve the relevant
PageLayout entities, walk the XML, and generate the proper layout, and the latency of the Metadata API would make performance unacceptable.