You need to sign in to do that
Don't have an account?
Brian Rosenfelt
Insert soql query language into a lightning controller
I created a lightning component for CASE that will update the TAB NAME (in Saleforce Console) with different data elements. Default TAB NAME would be the Case number. Currently, the new component will make the TAB NAME "Loan Name - Case Number". Instead, we'd like it to be "Loan Name - Record Type Name". In order to accomplish that, I know we need to add a SOQL query to query the record type name. I'm having a little trouble figuring out where to insert that SOQL query in my controller. Any help would be appreciated.
LIghtning Component:
Controller:
I believe this is the query language that needs to be inserted into the controller:
LIghtning Component:
<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global"> <!--Attributes--> <aura:attribute name="caseFields" type="Case"/> <!--Component Start--> <!--Lightning Workspace API--> <lightning:workspaceAPI aura:id="workspace"/> <!--Lightning Force Data to get Account record--> <force:recordData aura:id="caseRecordData" layoutType="FULL" recordId="{!v.recordId}" targetFields="{!v.caseFields}" recordUpdated="{!c.handleRecordUpdate}"/> <!--Component End--> </aura:component>
Controller:
({ handleRecordUpdate: function(component, event, helper) { var caseFields = component.get("v.caseFields"); var workspaceAPI = component.find("workspace"); workspaceAPI.getFocusedTabInfo().then(function(response) { var focusedTabId = response.tabId; workspaceAPI.setTabLabel({ tabId: focusedTabId, label: caseFields.E2E_LOAN_NAME__c + ' - ' + caseFields.CaseNumber }); }) } })
I believe this is the query language that needs to be inserted into the controller:
List<Case> lstCase = [select Id, RecordTypeId, RecordType.Name from Case limit 10]; for(Case x : lstCase) { system.debug('Case - ' + x.Id + ' - ' + x.RecordTypeId + ' - ' + x.RecordType.Name); }