+ Start a Discussion
mukesh guptamukesh gupta 

Remote Objects in lightning component instead of VF page

Hi Expert,

I want to use Remote Objects in lightning component , below code is working in visualforce  pages, but now i need to implement this code in lightning component.

for example:- 
  <!-- Remote Objects definition to set accessible sObjects and fields -->
    <apex:remoteObjects >
        <apex:remoteObjectModel name="Warehouse__c" jsShorthand="Warehouse" 
            fields="Name,Id">
            <apex:remoteObjectField name="Phone__c" jsShorthand="Phone"/>
        </apex:remoteObjectModel>
    </apex:remoteObjects>

Thanks
Mukesh
Raj VakatiRaj Vakati
You can use the lightning data service which iwill be similar 


refer this link 

https://trailhead.salesforce.com/en/content/learn/modules/lightning_data_service/lightning_data_service_get_started
<aura:component>
    <aura:attribute name="recordId" type="String" />
    <aura:attribute name="record" type="Object" />
    <aura:attribute name="simpleRecord" type="Object" />
     <force:recordData recordId="{!v.recordId}"
          targetRecord ="{!v.record}"
          targetFields ="{!v.simpleRecord}"
          fields="Id, Name" />
    <div class="recordName">
        <p class="slds-text-heading--medium">
            <lightning:formattedtext title="Record Name" value="{!v.simpleRecord.Name}" /></p>
    </div>
</aura:component>