I am trying to implement custom action in lightning . The below controller code is to add two numbers and display using toast. It is however throwing the error :     Action failed: c:CustomAction$controller$clickAdd [Cannot read   property 'setParams' of undefined]   The js controller code is:  ({ clickAdd: function(component, event, helper) {     // Get the values from the form     var n1 = component.find("num1").get("v.value");     var n2 = component.find("num2").get("v.value");     // Display the total in a "toast" status message     var resultsToast = $A.get("e.force:showToast");     resultsToast.setParams({         "title": "Quick Add: " + n1 + " + " + n2,         "message": "The total is: " + (n1 + n2) + "."     });       resultsToast.fire();         // Close the action panel var dismissActionPanel = $A.get("e.force:closeQuickAction");         dismissActionPanel.fire();     } })   The component code is :      &lt;!--quickAdd.cmp--&gt; &lt;aura:component implements="force:lightningQuickAction"&gt;     &lt;!-- Very simple addition --&gt; &lt;lightning:input type="number" name="myNumber" aura:id="num1" label="Number 1"/&gt; +     &lt;lightning:input type="number" name="myNumber" aura:id="num2" label="Number 2"/&gt;     &lt;br/&gt;     &lt;lightning:button label="Add" onclick="{!c.clickAdd}"/&gt; &lt;/aura:component&gt;   I have copied this piece of code directly from the standard lightning guide.
122134
I am dynamically creating a toast as shown below. This toast is created when response is received from server. I have created a component for toast and am dynamically creating it using $A.createComponent. The toast is getting fired when I am testing it in SF1 simulator or when I  have added my component in app builder. However, it is not getting thrown on screen, thought it is generated as seen in console.log, in case when I test it using standalone app (adding parent component to .app file and then preview) OR when i render my component using ltng:out in a VF page. What may be the reason for this?     controller from where dynamically toast is created:   . . . if (component.isValid() &amp;&amp; state === "SUCCESS") {             console.log("Values updated successfully!");             //$A.get('e.force:refreshView').fire(); //this is also not working             this.createToastComponent(component, 'success', 'Success!', 'Record Saved successfully!');      createToastComponent : function(component, type, title, message){      $A.createComponent(         "c:ToastComponent",         {             "type" : type,             "title" : title,             "message": message         },         function(newToast, status, errorMessage){             if(errorMessage === null){                 //do nothing             }             else{                 console.log('Toast errorMessage: '+ errorMessage);             }         }     ); },      toastComponent UPDATED:   &lt;aura:component &gt; &lt;aura:attribute name="type" type="String" /&gt; &lt;aura:attribute name="title" type="String" /&gt; &lt;aura:attribute name="message" type="String" /&gt; &lt;!--&lt;aura:handler name="init" action="{!c.handleInit}" value="{!this}" /&gt;--&gt;  &lt;div class="slds"&gt;     &lt;div class="slds-notify_container"&gt;         &lt;div aura:id="successToast" class="slds-notify slds-notify--toast slds-theme--success" role="alert"&gt;             &lt;span class="slds-assistive-text"&gt;Success&lt;/span&gt;             &lt;button class="slds-button slds-notify__close slds-button--icon-inverse" title="Close"&gt;                 &lt;c:SVGIcon svgPath="/resource/SLDS214/assets/icons/action-sprite/svg/symbols.svg#close"                            class="slds-button__icon slds-button__icon--large" assistiveText="Close"/&gt;                 &lt;span class="slds-assistive-text"&gt;Close&lt;/span&gt;             &lt;/button&gt;             &lt;div class="slds-notify__content slds-grid"&gt;                 &lt;div class="slds-col slds-align-middle"&gt;                     &lt;h2 class="slds-text-heading--small "&gt;{!v.message}&lt;/h2&gt;                 &lt;/div&gt;             &lt;/div&gt;         &lt;/div&gt;     &lt;/div&gt; &lt;/div&gt;        toast component controller:   ({ handleInit : function(component, event, helper) {      var toastEvent = $A.get("e.force:showToast");     console.log('toastEvent: '+ toastEvent+ 'title: '+ component.get("v.title")+ 'message: '+ component.get("v.message"));     toastEvent.setParams({         "title": component.get("v.title"),         "message":  component.get("v.message"),         "type": component.get("v.type")     });     toastEvent.fire(); }   })     Output in console.log:   toastEvent: SecureAuraEvent: [object Object]{ key: {"namespace":"c"} }title: SUCCESS!message: Record created Successfully
12365
I am making an component in lightning. i want to know how can we use the state and county picklist in this particular code.  secoundly the functionality of save and cancel button is also not working in the lightning component.Help me out.  Thanx          &lt;div class="container"&gt;                     &lt;form class="formbusiness"&gt;         &lt;h1&gt;Account Information&lt;/h1&gt;         &lt;div class="row"&gt;             &lt;h1 class="headingB"&gt;Business Account Info&lt;/h1&gt;             &lt;div class="col-md-6"&gt;                 &lt;ui:inputText aura:id="b_cname" class="form-control" value="{!v.newBAccount.Name}" placeholder="Company Name" required="true"/&gt;                 &lt;ui:inputNumber aura:id="b_bphone" class="form-control" value="{!v.newBAccount.Phone}" placeholder="Phone" required="true"/&gt;                 &lt;ui:inputEmail aura:id="b_bemail" class="form-control" value="{!v.newBAccount.Email__c}" placeholder="Email"/&gt;             &lt;/div&gt;             &lt;div class="col-md-6"&gt;                 &lt;ui:inputText aura:id="b_bstreet" class="form-control" value="{!v.newBAccount.BillingStreet}" placeholder="Billing Street"/&gt;                 &lt;ui:inputText aura:id="b_bcity" class="form-control" value="{!v.newBAccount.BillingCity}" placeholder="Billing City"/&gt;                 &lt;ui:inputText aura:id="b_state" class="form-control" value="{!v.newBAccount.BillingStateCode}" placeholder="State"/&gt;                 &lt;ui:inputText aura:id="b_country" class="form-control" value="{!v.newBAccount.BillingCountryCode}" placeholder="Country"/&gt;                 &lt;ui:inputNumber aura:id="b_zipcode" class="form-control" value="{!v.newBAccount.BillingPostalCode}" placeholder="Zip Code"/&gt;             &lt;/div&gt;         &lt;/div&gt;         &lt;div class="row"&gt;             &lt;h1 class="headingB"&gt;Respective Contact&lt;/h1&gt;             &lt;div class="col-md-6"&gt;                 &lt;ui:inputText aura:id="b_rcfirstname" class="form-control" value="{!v.newBRCAccount.FirstName}" placeholder="First Name"/&gt;                 &lt;ui:inputText aura:id="b_rclastname" class="form-control" value="{!v.newBRCAccount.LastName}" placeholder="Last Name" required="true"/&gt;                 &lt;ui:inputNumber aura:id="b_rcmobile" class="form-control" value="{!v.newBRCAccount.MobilePhone}" placeholder="Mobile" required="ture"/&gt;             &lt;/div&gt;             &lt;div class="col-md-6"&gt;                 &lt;ui:inputEmail aura:id="b_rcemail" class="form-control" value="{!v.newBRCAccount.Email}" placeholder="Email"/&gt;                 &lt;ui:inputNumber aura:id="b_rcphone" class="form-control" value="{!v.newBRCAccount.Phone}" placeholder="Phone"/&gt;                                 &lt;/div&gt;         &lt;/div&gt;         &lt;div class="buttonB"&gt;             &lt;ui:button label="Save" press="{!c.createBAccount}"/&gt;             &lt;ui:button label="Cancel"/&gt;         &lt;/div&gt;             &lt;/form&gt;         &lt;/div&gt;
85206
I have this below code where i am trying to first search an account name and on hit button it displays the result set.  On the button click i am also loading an child component which is displaying the id of the record.  I need the child component should get displayed once i click on the record.  How can i achieve this -   Parent Component -   &lt;aura:component controller="SimpleAccountController"&gt;     &lt;aura:attribute name="account" type="account[]"/&gt;     &lt;ui:outputText aura:id="outName" value="" class="text"/&gt;     &lt;ui:inputText aura:id="name" label="Enter Name:" placeholder="Your Name" /&gt;     &lt;ui:button aura:id="button" buttonTitle="Click to see what you put into the field" class="button" label="Click me" press="{!c.getInput}"/&gt;     &lt;aura:iteration var="acc" items="{!v.account}"&gt;             &lt;a onclick="{!c.accountselected}" data-recId="{!acc.Id}"&gt;         &lt;p&gt;{!acc.Name} : {!acc.Type} : {!acc.Industry} : {!acc.Rating}&lt;/p&gt;             &lt;/a&gt;         &lt;c:HelloWorkdChildCmp selectedaccount="{!acc.Id}" /&gt;     &lt;/aura:iteration&gt; &lt;/aura:component&gt;   COntroller -   ({     getInput : function(cmp, evt) {         var myName = cmp.find("name").get("v.value");         var myText = cmp.find("outName");         var greet = "Hi, " + myName;         myText.set("v.value", greet);         var action = cmp.get("c.seaAcc");         action.setParams({ "s" : myName });         action.setCallback(this, function(response) {             var state = response.getState();             if (state === "SUCCESS") {                 cmp.set("v.account", response.getReturnValue());                 //alert("From server: " + response.getReturnValue());             }         });         $A.enqueueAction(action);     },      accountselected : function(cmp, evt) {        console.log(evt.currentTarget.getAttribute("data-recId")) ;     }  })   Child component -   &lt;aura:component &gt;     &lt;aura:attribute name="selectedaccount" type="String"/&gt;     &lt;div&gt;Id: {!v.selectedaccount}&lt;/div&gt; &lt;/aura:component&gt;
109025
Let's say I have a Lightning-Web-Component with a select list with dynamic options where the value is a user Id and the label is the user's name:  &lt;select class="slds-select" onchange={handleSelectChange} disabled={isDisabled}                           data-value={step.selectedUser} &gt;                                 &lt;option value=""&gt;--None--&lt;/option&gt;                                 &lt;template for:each={step.approvalTemplateStep.Approval_Step_Users__r} for:item="user"&gt;                                     &lt;option key={user.key} value={user.User__c}&gt;                                         {user.User__r.Name}&lt;/option&gt;                                 &lt;/template&gt;                             &lt;/select&gt;    How do I prepopulate the select option with a value? I have the value I want to be prepopulated in the variable called step.selectedUser.  Here's what I see on page load:   Here's what I should see:
47186
Opening Lightning Application which refers to SObject for which current running user doesn't have permission raises internal server error with Gack Id -227057212  Steps to reproduce:   Create custom object Custom_Object__c Create Apex Class   public class PILexCont { @AuraEnabled public static Custom_Object__c performBusinessLogic( ){     Custom_Object__c record = new Custom_Object__c();     insert record;     return record; } }  Create an App  &lt;aura:application controller="PILexCont"&gt; &lt;aura:attribute name="record" type="Custom_Object__c"/&gt; &lt;button onclick="{!c.performLogic}"&gt;Perform business logic&lt;/button&gt; &lt;/aura:application&gt;  With Javascript Controller   ({ performLogic : function(component, event, helper) { var action = component.get( "c.performBusinessLogic" );  action.setCallback(this, function(response  ) {     var state = response.getState();     if (component.isValid() &amp;&amp; state === "SUCCESS") { /* component.isValid() simply, checks if the component has been destroyed or not. (http://salesforce.stackexchange.com/questions/81998/what-does-the-lightning-component-method-component-isvalid-do) */         alert('component valid, state success');          var record = response.getReturnValue();         component.set("v.record", record );      } else {         alert('error?'  );     }   }); $A.enqueueAction(action); } })  Open an app by a user who doesn't have permission to Custom_Object__c      Obtain the error         An internal server error has occurred     Error ID: 1557802061-15979 (-227057212)
45965
I got some references for Visualforce tab creation but unable to find the issue. onclick function is not passing control to controller. Any help will be appreciated.  Visualforce Page  &lt;apex:page id="Registration" showHeader="false" controller="SolutionLibraryTabController"  title="Solution Library" standardStylesheets="false"&gt;     &lt;style&gt;         .activeTab {background-color: #236FBD; color:white; background-image:none}         .inactiveTab { background-color: lightgrey; color:black; background-image:none}     &lt;/style&gt;     &lt;apex:tabPanel switchType="client" tabClass="activeTab"  inactiveTabClass="inactiveTab" value="{!var}" &gt;         &lt;apex:tab label="Search" name="srch" id="srch" onclick="setActiveTab('srch')"&gt;             &lt;apex:include pageName="SolutionLibrarySearch"/&gt;                     &lt;/apex:tab&gt;         &lt;apex:tab label="Insert" name="insrt" id="insrt" onclick="setActiveTab('insrt')"&gt;             &lt;apex:include pageName="SolutionLibraryInsert"/&gt;                                                &lt;/apex:tab&gt;     &lt;/apex:tabPanel&gt;     &lt;apex:form&gt;         &lt;apex:actionFunction name='setActiveTab' action='{!setActiveTab}' reRender="none"&gt;             &lt;apex:param id='tabname'  assignTo="{!var}" value=""/&gt;         &lt;/apex:actionFunction&gt;     &lt;/apex:form&gt; &lt;/apex:page&gt;   Cotroller  public class SolutionLibraryTabController {     /*Tab var*/     public String var{get;set;}      public SolutionLibraryTabController(){         var = 'srch';     }      public PageReference setActiveTab() {         if(var=='srch'){             var='insrt';         }         else {             var = 'srch';         }         return null;     } }
21774
Is there a way we can get the value from force:RecordData on init ? I am getting the onclick event of a button.  &lt;aura:handler name="init" value="{!this}" action="{!c.doInit}"/&gt;     &lt;aura:attribute name="recordId" type="String"/&gt;      &lt;aura:attribute name="showButton" type="Boolean" default="false"/&gt;     &lt;aura:attribute name="Opportunity" type="Object"/&gt;        &lt;aura:attribute name="parentOpp" type="Object"/&gt;     &lt;aura:attribute name="oppLoadError" type="String"/&gt;     &lt;force:recordData aura:id="oppRecordLoader"                       recordId="{!v.recordId}"                       fields="Id,                               Name,                               AccountId,                               Cohort_Sem__r.End_date__c,                               LeadSource,                               Staff_Referral_Detail__c,                               lead_source_detail__c"                       targetRecord="{!v.Opportunity}"                       targetFields="{!v.parentOpp}"                       targetError="{!v.oppLoadError}"                       /&gt;   JS:  doInit: function(component, event, helper) {                     var opp = component.get("v.parentOpp");                   console.log('Name Value: '+ opp.Name);     }   Error:     Action failed: c:createIWSRecord$controller$doInit [Cannot read   property 'Name' of null] quickActionHandlerHelper.js failed to create   component - forceChatter:lightningComponent
15183
I have action override on New Case button which runs our custom component.  As you know, we can create a new Case from different places in org, e.g. from related lists. When creating a Case from related list on Account using standard action in Lightning we have prepopulated AccountId to the lookup field. Is it possible to do the same with custom component? I can't catch the AccountId using force:hasRecordId, because action override redirects me to the new page with custom component where I don't have a context of Account. URL also doesn't contain its Id. What can I do to grab Id of context object and populate it to my component?
108304
Is there any way to override 'New' standard button with lightning component and refer the parent record as prepopulated value in record creation screen?  I saw in some posts to achieve this using visualforce override and pass parent recordid in url but I wanted to achieve using only lightning component.  Please let me know if more details are needed.    As shown in screenshot I have to override this standard 'New' action to open a form and prepoulated opportunity and account information and few fields of Agreement record itself.
40145
I'm trying to set an attribute inside the init method as .  Component  &lt;aura:component implements="flexipage:availableForAllPageTypes" access="global" &gt;      &lt;aura:handler name="init" value="{!this}" action="{!c.doInit}"/&gt;      &lt;aura:attribute name="canCreateRecord" type="Boolean" default="false" /&gt;       {!v.canCreateRecord} &lt;!-- outputs - false --&gt;  &lt;/aura:component&gt;      Controller  ({     doInit: function(cmp){             cmp.set("v.CanCreateRecord",  true );                             } })   When I output {!v.CanCreateRecord} inside the view, I get the default value of 'false'.     According to , the attribute should be set inside the init function before it is rendered. However, it's not happening in my case. What could I be missing?
84951
I would have expected that when a dynamically created lightning component is assigned as another component's attribute of type Aura.Component[],  also referencing it in the parent component's markup by including something like {!v.attributeName}, then the parent component's JavaScript would be able to find that Facet by calling component.find() and passing in the aura:id value of the dynamically created component.  I have attempted this, but the result of the find() call is undefined. Code samples are below.  The parent component with the "stepData" facet... (created to test the stepData component during the development process)  &lt;aura:component &gt; &lt;aura:attribute name="stepData" type="Aura.Component[]"/&gt;  &lt;aura:handler name="completedActionFired" event="c:actionComplete" action="{!c.captureDataResult}" /&gt; &lt;aura:handler name="init" action="{!c.doInit}" value="{!this}"/&gt;  {!v.stepData}  &lt;!-- Include the SLDS static resource (adjust to match package version) --&gt; &lt;ltng:require styles="{!$Resource.SLDS202 + '/assets/styles/salesforce-lightning-design-system.css'}"/&gt;  &lt;lightning:layout horizontalAlign="space"&gt;     &lt;lightning:layoutItem flexibility="grow" padding="horizontal-medium"&gt;         &lt;lightning:button variant="brand" label="Get Object Data" onclick="{! c.getObjectData }" /&gt;         &lt;br/&gt;&lt;br/&gt;         &lt;lightning:button variant="brand" label="Find Component and Get Object Data" onclick="{! c.findObjectData }" /&gt;         &lt;br/&gt;&lt;br/&gt;     &lt;/lightning:layoutItem&gt; &lt;/lightning:layout&gt; &lt;/aura:component&gt;   The parent component controller, where findObjectData() cannot find the Facet component by its aura:id, but getObjectData() can get it by using the attribute name...  ({ doInit : function(component, event, helper) {     var dataMap = {         "testString" : "test value",         "testMap" : {"key1":"value1", "key2":"value2"}     };      var attributes = {         "aura:id" : "stepData",         "dataMap": dataMap     };      $A.createComponents(         [[ "c:stepData", attributes ]],         function(results) {             component.set("v.stepData", results[0]);         }     ); }, findObjectData : function(component, event, helper) {     // try finding component by aura:id     var stepData = component.find("stepData");     if(stepData == null) {         console.log('stepData is not found');         return;     }      // try calling aura:method on stepData     var result = stepData.getObject("testString");     console.log(result); }, getObjectData : function(component, event, helper) {     // get stepData by accessing attribute     var stepData = component.get("v.stepData")[0];     console.log(JSON.stringify(stepData.get("v.dataMap")));      // able to get dataMap attribute from stepData component     var dataMap = stepData.get("v.dataMap");     console.log(dataMap.testString);      // able to call aura:method, but does not return any value to caller     var result = stepData.getObject("testString");     console.log(result); } })   Lightning Component Tree shows the aura:id included on the stepData component reference...    console log shows the "get" button clicked, then the "find" button clicked, where "stepData is not found" indicates find() and aura:id did not successfully locate the dynamically created Facet component.
9971
I'm trying to build a custom datable because I want the functionality to sort, search and paginate and also add action buttons in each row. Initially, my VF page was using  but we have now decided to rebuild that page in LWC.  I found a similar  but it hasn't really worked for me.  I then found  (Javascript) and  (ES2018) I have tried to implement Vanilla Datatables but I keep running into issues such as:      TypeError: Cannot read property 'length' of undefined   The above error is thrown because the library is unable to find the body of the table.   My point is that I feel this library won't work because it's using document, window and so on.   I was wondering if there is a way I could convert this library to something that is more suited to LWC basically have it "export" the modules. Since I'm not a JS expert I'm unable to put the pieces together.   Just for some context, I'll post my code here:  &lt;template&gt;     &lt;table class="sobject-table slds-table slds-table_cell-buffer slds-table_bordered"&gt;         &lt;thead&gt;             &lt;tr class="slds-line-height_reset"&gt;                 &lt;template for:each={fieldSetData} for:item="field"&gt;                     &lt;th key={field.apiName} title={field.fieldLabel} class="" data-scope="col"&gt;                         &lt;div class="slds-truncate" title={field.fieldLabel}&gt;{field.fieldLabel}&lt;/div&gt;                     &lt;/th&gt;                 &lt;/template&gt;             &lt;/tr&gt;         &lt;/thead&gt;         &lt;tbody&gt;             &lt;template for:each={records} for:item="row"&gt;                 &lt;tr key={row} class="slds-hint-parent"&gt;                     &lt;template for:each={row} for:item="data"&gt;                         &lt;td key={data.id} data-label="Name" data-scope="row"&gt;{data.value}&lt;/td&gt;                     &lt;/template&gt;                 &lt;/tr&gt;             &lt;/template&gt;         &lt;/tbody&gt;     &lt;/table&gt; &lt;/template&gt;   import {LightningElement, api, wire} from 'lwc'; import {processRecords} from 'c/recordGenerator'; import getFieldSetData from '@salesforce/apex/FieldSetData.getFieldSetData'; import getSobjectRecords from '@salesforce/apex/DeomoCTRL.getRecords'; import VanillaDatatable from '@salesforce/resourceUrl/VanillaDatatable'; import {loadScript, loadStyle} from 'lightning/platformResourceLoader';  export default class ManageSelectedIndicators extends LightningElement {     @api recordId;     records;     fieldSetData;     @wire(         getFieldSetData,         {objectName: 'SOBJECTName', fieldSet: 'FIELSETName'}     ) wiredFieldSetData({error, data}) {         console.log('wired called in Child')         if (data) {             this.fieldSetData = data;             this.getData();         }     }       constructor() {         super();         console.log('Constructor called in Child');     }      connectedCallback() {         console.log('Connected callback');     }      renderedCallback() {         console.log('Rendered callback');         Promise.all([              loadScript(this, VanillaDatatable + '/VanillaDataTables/src/vanilla-dataTables.js')          ]).then(() =&gt; {              const table = new DataTable(                  document.getElementsByClassName('.sobject-table'),                  //Also tried this.template.querySelector('.sobject-table'),                  {searchable: true, sortable : true}              );          })          .catch(error =&gt; {             console.log(error);          });     }      getData() {         getSobjectRecords ({             sobjectId: this.recordId         })         .then(response =&gt; {             this.records= processRecords(response, this.fieldSetData);         })         .catch((error) =&gt; {             console.log(error);         });     }  }   Edit: I have also tried lwc:dom="manual" that didn't seem to work either.  Is there any other way I could achieve these functionalities? Or do I have to write custom code to achieve this?
42281
I have a controller with an action method as follows:  public class InventoryController : Controller {     public ActionResult ViewStockNext(int firstItem)     {         // Do some stuff     } }   And when I run it I get an error stating:     The parameters dictionary does not contain a valid value of type 'System.Int32' for parameter 'firstItem'. To make a parameter optional its type should either be a reference type or a Nullable type.   I had it working at one point and I decided to try the function without parameters.  Finding out that the controller was not persistant I put the parameter back in, now it refuses to recognise the parameter when I call the method.  I'm using this url syntax to call the action:  http://localhost:2316/Inventory/ViewStockNext/11   Any ideas why I would get this error and what I need to do to fix it?   I've tried adding another method that takes an integer to the class it it also fails with the same reason.  I've tried adding one that takes a string, and the string is set to null.  I've tried adding one without parameters and that works fine, but of course it won't suit my needs.
62918
There are 2 ways to get values from UI in JS controller.   component.get("v.name"); component.find("name");   My question is when both can serve the same purpose, which one to use and when?
112886
I am building a menu component.  One menu-item is a sub-menu with list of opportunities, this list is created with aura:iteration over a list of opportunities.  When selecting a menu or a sub-menu, I need to make it look selected (change css attribute). For this to happen, I need to find this menu item in my controller.  If I add id attribute to my item markup and use the event attribute on my controller (event.currentTarget.id), I can catch the item itself and change it's style, this works:  MARKUP       &lt;aura:iteration items="{!v.opportunities}" var="opp"&gt;     &lt;li class="slds-dropdown__item" role="presentation"&gt;         &lt;a href="javascript:void(0);" role="menuitem" tabindex="-1" id="{!opp.Id}" onclick="{!c.openItemFromMenu}"&gt;             &lt;span class="slds-truncate" title="{!opp.Name}"&gt;{!opp.Name}&lt;/span&gt;         &lt;/a&gt;     &lt;/li&gt; &lt;/aura:iteration&gt;   CONTROLLER    openItemFromMenu: function(component, event, helper) {     // get the id     var oppId = event.currentTarget.id;     // choose it (select menu)     var selectedItemNew = component.find(oppId);     selectedItemNew.style = "background: rgb(216, 237, 255);" }   PROBLEM  when I try to change the menu selected not from the click of the item (event that is triggered from another page) - I have added an event handler to change the menu item, and I send the opportunity id through that event. Then (after adding aura:id to my item, I am trying to find this menu item of this oppId with component.find in my controller - this does not work:  CHANGED MARKUP  add: &lt;aura:handler name="eventSelectMenuItem" event="c:myEvent" action="{!c.openItemFromMenu}" /&gt; change: &lt;a href="javascript:void(0);" role="menuitem" tabindex="-1" id="{!opp.Id}" onclick="{!c.openItemFromMenu}" aura:id="{!opp.Id}"&gt;   CHANGED CONTROLLER  openItemFromMenu: function(component, event, helper) {     // get the id from the event     var oppId = event.getParam("recordId");     // choose it (select menu)     var selectedItemNew = component.find(oppId);     selectedItemNew.style = "background: rgb(216, 237, 255);" }   QUESTION  Does component.find for aura:id within an aura:iteration suppose to work?  If not - is there a workaround?  If it does suppose to work - what am I doing wrong?
11598
Can anyone help me? Trying to do very simple function to navigate from component to another. I copied the code from Developers guide, but for some reason it doesn't work for me.  My function to navigate to another component:  nav : function(component, event, helper) {             var evt = $A.get("e.force:navigateToComponent");             evt.setParams({                 componentDef : "c:navToComponentTest2",                 componentAttributes: {                     continent : component.get("v.continent")                 },                 isredirect : false             });             evt.fire();     }   And here's the error I get in my Lightning App   EDIT: Got it working in Lightning tab. Would it be somehow possible to get it working in communities as well? Or is there anyway to make same functionality?
87646
Salesforce has functions that do a lot of basic web app functionality for you, called Event Reference. They can be found here   On the editRecord Event Reference, found here   essentaily, I create a   &lt;ui:button label="Edit" press="{!c.editRecord}"/&gt;   on my component, reference the attribute on the page and add the function from the docs in the controller  editRecord : function(component, event, helper) {     var editRecordEvent = $A.get("e.force:editRecord");      console.log("record id is: " + component.get("v.item.Id"));     console.log("editRecordEvent value is: " + editRecordEvent);      editRecordEvent.setParams({         "recordId": component.get("v.item.Id")     });      editRecordEvent.fire(); }   correct?  Here is the odd thing. From the console.logs, I get the record id, but the editRecordEvent returns undefined. What is going on? Is there something I need to reference in my component to use Event Reference?