I am trying to call one of my components by aura:id so I can store the value, however I am getting an error saying cmp.find.get is not a function.


<aura:iteration items="{!v.contacts}" var="contact" indexVar="studentNo">
    <li class="minli">
        <div class="studentPhotoDiv"><ui:outputRichText value="{!contact.Photo__c}" class="studentPhoto"/></div>
        <div class="studentNameDiv"><ui:outputText value="{!contact.Name}" class="studentName" aura:id="studentName"></ui:outputText></div>
        <div class="studentNameDiv"><ui:outputText value="{!contact.Id}" class="studentName" aura:id="studentID"></ui:outputText></div>
        <div class="studentSelectDiv"><ui:button label="Check-in" class="studentSelect" press="{!c.studentSelect}"></ui:button></div>
        <br style="clear: both;" />


studentSelect : function(component,event,helper) {
    var studentId = component.find("studentID").get("v.value");

I am trying to get the value of the second ui:outputText tag. I gave it an aura:id of studentID and that is what I am referencing in the controller.

  • Are you sure you Client side controller has method : (cmp,helper,event), you are trying to find component.find when the system is complaining cmp.find, hence guessing you parameter name is not right in your controller
    – Rao
    Commented Jul 20, 2017 at 21:02
  • post your client side controller for reference
    – Rao
    Commented Jul 20, 2017 at 21:07
  • 1
    I feel this may be an x-y problem. You might try asking about the original problem rather than going with this solution.
    – sfdcfox
    Commented Jul 20, 2017 at 21:14
  • @Rao I posted my whole controller. Sorry the error im getting in component.find.get and that is what i have defined Commented Jul 21, 2017 at 0:08

2 Answers 2


find() returns different types depending on the result.

• If the local ID is unique, find() returns the component.

• If there are multiple components with the same local ID, find() returns an array of the components.

• If there is no matching local ID, find() returns undefined.

To find the local ID for a component in JavaScript, use cmp.getLocalId().

Every component has a unique globalId, which is the generated runtime-unique ID of the component instance. A global ID is not guaranteed to be the same beyond the lifetime of a component, so it should never be relied on. A global ID can be useful to differentiate between multiple instances of a component or for debugging purposes.

To create a unique ID for an HTML element, you can use the globalId as a prefix or suffix for your element. For example:

In your browser’s developer console, retrieve the element using document.getElementById("_footer"), where is the generated runtime-unique ID.


If there's more than one element that matches a aura:id, find returns a list. You would need to check if it's an array first.

  • So it looks like it does return an array, any suggestions to get individual id of each? Commented Jul 21, 2017 at 14:20

You must log in to answer this question.

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