0

Comp:

 <aura:attribute name="ServiceRequestRecordFields" type="WorkOrder"/>

    <force:recordData aura:id="recordEditor"
                      layoutType="FULL"
                      targetError="{!v.recordError}"
                      targetRecord="{!v.ServiceRequestRecord}"
                      targetFields ="{!v.ServiceRequestRecordFields}"
                     />

 <c:customLookupComp objectAPIName="account" IconName="standard:account" selectedRecord="{!v.ServiceRequestRecordFields.AccountId}" label="Account Name"/> <!--  isRequired="true" AutoPopulate="true" -->

JS:

 var servicereqAccid = component.get("v.ServiceRequestRecord");
         console.log('servicereqAccid',servicereqAccid.AccountId);

servicereqAccid is giving Undefined error, can someone please help.. thank in advance

3 Answers 3

1

You didn't actually load the record. You need to specify the record Id:

<force:recordData aura:id="recordEditor"
                  recordId="{!v.recordId}"
                  layoutType="FULL"
                  targetError="{!v.recordError}"
                  targetRecord="{!v.ServiceRequestRecord}"
                  targetFields="{!v.ServiceRequestRecordFields}"
                  recordUpdated="{!c.handleRecordLoaded}"
                 />

You will also need to wait until the record is loaded (see example above).

1

Your Data Service has no identifier of which record it should fetch. Add the following attribute to the tag:

recordId="{!v.recordId}"
0

You have aura:attribute tag for ServiceRequestRecordFields. Do you also have one for ServiceRequestRecord? If not, you may need to add it to your cmp file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .