Quantcast
Channel: Get object apiname based on recordid in lightning web component - Salesforce Stack Exchange
Viewing all articles
Browse latest Browse all 3

Get object apiname based on recordid in lightning web component

$
0
0

Is it possible to het the object apiname based on a recordId in a lwc without a call to apex?

Something like apex but then without going to backend:

Id recordId = '001g000001jmmCA';System.debug('Object Name: '+ recordId.getsobjecttype());

I currently have a handleRowAction(event) which gets the record id from a lightning-datatable which dynamically gets fields and values as a replacement of related lists. I use this component several times on e.g. account record, so on handle handleRowAction(event) it would be easy to get the object by recordId so I can pass recordId and object to a lightning-record-form:

<lightning-record-form record-id={recId} object-api-name={sObj} mode="readonly"                                layout-type="Full" columns="5" fields="Name">

I already solved this by an apex call to the backend but was wondering if this could be done easier.


Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>