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

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).

| improve this answer | |
1

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

recordId="{!v.recordId}"
| improve this answer | |
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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.