Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now
6

For reasons I don't understand, you have to invoke the setMessage method to output a custom message on the client-side: String m = 'My cusom msg here'; AuraHandledException e = new AuraHandledException(m); e.setMessage(m); throw e;


5

Generally when an component/app runs in LEX, it will not get destroyed as soon as you navigate to a different view. Have a look at the post here. Also destroying component manually has a impact too which explained here. I believe action associated with destroy event will not be called immediately because of the component destroying issue in LEX. The right ...


4

Yes, you can get the toast information, as it is an application event, and thus propagates to all interested listeners. Here's the code I wrote that demonstrates this: <aura:component implements="flexipage:availableForAllPageTypes"> Toast Processor <aura:handler name="init" value="{!this}" action="{!c.init}" /> <aura:handler ...


3

I am assuming you are loading values for parent attribute from init handler thats why it gets set as undefined initially. ' There are few ways to handle it: Put the child components inside an aura:if and load them once the parent init has fired and the attributes on the parent especially the ones passed to child components are set. Set an attribute on init ...


3

I don't believe there is directly. I assume you want to perform different actions based on what caused it? If so, it would be best to either directly call the method you want to occur, in a helper method or using the <aura:method> registration, when you use component.set() in your code. If you do that then the button click will have its own logic ...


3

I think your acctsChanged method will only be called when the accts list attribute is changed not when the Name field of one of the items in the list is changed. So for this case use: <ui:inputText label="Acct " value="{!currAcct.Name}" keyup="{!c.acctsChanged}"/>


2

Instead of writing many lines of code, you can achieve with below code. Component code <aura:attribute name="IsSpinner" type="Boolean"/> <aura:if isTrue="{!v.IsSpinner}"> <lightning:spinner variant="brand" size="large" /> </aura:if> Helper Js Code showSpinner:function(cmp){ cmp.set("v.IsSpinner",true); }, ...


2

That particular line will never be executed because the query two lines above will not return null if no records are found. Instead, it'll throw an exception itself. See Using SOQL Queries That Return One Record. You can handle this by catching the exception yourself and re-raising. The pattern would look something like this (pseudo-code): try { Case ...


1

If you want to do this, you need a component that represents the child and you need to have the change handlers for its presentation to generate an event. You then have the parent component manage the child components and have a handler that handles the events from the children as needed. Take a look at the documentation for more advice.


1

You need to ask the server's response for the actual message, rather than just passing the error object to your Toast event. There are some great, thorough examples on the Salesforce Developer Blog. Here's their example of how to handle an error return via a Toast message, in a helper function: handleErrors : function(errors) { // Configure error toast ...


1

I would say its just a false positive from the Scanner .Throwing AuraHandled exception using the code like below is completely valid throw new AuraHandledException(e.getMessage());//Valid


1

Figured it out! So I'm pretty sure the issue was related to salesforce requiring $A.setCallback on certain event listeners/timeouts. Apparently if you leave this out it can mess with your event calls, but there's a simple trick that solves the problem without even needing $A.getCallback. Instead of calling helper.runSearch() inside the eventListener/timeout ...


Only top voted, non community-wiki answers of a minimum length are eligible