The goal is to get the order name of the order record and present this on the order record page.
Apex Class
Controllerpublic class OrderController {
@AuraEnabled
public static List<Order> getOrders(Id recordId) {
return [Select Id, Name__c From Order Where Id = :recordId];
}
}
<aura:component controller="OrderController" implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
<aura:attribute name="recordId" type="Id" />
<aura:attribute name="Order" type="Order" />
<force:recordData aura:id="orderRecord"
recordId="{!v.recordId}"
targetFields="{!v.Order}"
layoutType="FULL"
/>
<lightning:card iconName="standard:contact" title="{! 'Project Name: ' + v.Order.Name__c}">
</lightning:card>
</aura:component>
In my sandbox this is how the component looks like:
After sending it to my live environment and adding the component to the page layout. It is not populated and stays empty. What am I missing?
Kind regards,
Noortje
4 answers
I found the problem: the deployment was not succesful because of the code coverage. I am not sure how to structure test classes for this apex class. Any tips? :)