Skip to main content
8 votes
Accepted

Clarifying Refactor Lesson

In the original code, both createExpense() and updateExpense() construct and enqueue a server-side action, calling the same Apex controller method, saveExpense(). That involves some duplication of ...
David Reed's user avatar
  • 93.2k
6 votes
Accepted

lightning callback not firing

According to this post, "a javascript method name in a component controller can never be the same name in an apex lightning controller": Enqueued action not executed in Lightning Component Just need ...
Instread's user avatar
  • 633
6 votes
Accepted

Apex called from Aura omits null elements from response

Looks like Aura strips out JSON nulls. You can use the workaround of sending String from Aura-enabled method and then parsing them in javascript @AuraEnabled public static String returnMapWithNull() ...
Pranay Jaiswal's user avatar
5 votes
Accepted

ui:inputSelect -> select value dynamically

You can set the attribute value ("v.value") to specify which option should be selected, as follows: //select the right campaign component.find("campaignID").set("v.value", component.get("v.item....
sfdcfox's user avatar
  • 495k
5 votes
Accepted

How to send List<Wrapper class> from Lightning component to Apex Controller?

Fixed using this approach. In Java script Callback, var actSave = component.get("c.saveDataDML"); actSave.setParams({ "listToSaveString": JSON.stringify(itemList) }); ...
Pasan Eeriyagama's user avatar
5 votes

When LWC that is used in Flow Screen is destroyed?

Its slightly tricky. disconnectedCallback is only called if a component is removed from the DOM, and this depends on the experience you are in. Lightning Experience keeps the 5 previous pages you've ...
Aditya Naag's user avatar
4 votes
Accepted

Javascript remoting call back function placement

I would say that your callback function you are passing is in this case undefined. The error you notice also happens when you are passing an undefined value as one of the parameters. For example your ...
Lieven Juwet's user avatar
  • 1,017
4 votes
Accepted

Help Interpret Peculiar Way of Handling SUCCESS and ERROR in Lightning Callback

This is in the documentation, under JavaScript API / Action. setCallback (Object scope, function callback, String name) Sets the callback function that is executed after the server-side action ...
sfdcfox's user avatar
  • 495k
4 votes
Accepted

Apex Paramater always null

In your class you are declaring the variable name as jewishEducatorString however, when you are setting parameters in your client side controller you are attempting to pass it as jewishEducator. so, ...
glls's user avatar
  • 20.2k
4 votes
Accepted

The response from the backend takes too long

You need to make sure that any actions you're calling are called within the framework lifecycle. This typically means that you need to use $A.getCallback in situations where you're not responding to a ...
sfdcfox's user avatar
  • 495k
4 votes
Accepted

I have two helper functions that are the exact same, one executes and one doesn't. How come?

From this documentation, Use unique names for client-side and server-side actions in a component. A JavaScript function (client-side action) with the same name as an Apex method (server-side ...
salesforce-sas's user avatar
3 votes

Restaurant Locator Trailhead Project Lightning Error

I suspect it has something to do with data not existing before you call it. It seems like you have a bunch of stuff mixed up. In this function: doLayout: function(response, component) { ...
pchittum's user avatar
  • 19.7k
3 votes

HTML Button not calling Apex Controller

It looks like you meant: $("#btn").click(function() { You need to make sure that the ID matches what you're querying. As an aside, I wouldn't use jQuerry for this purpose; it'd be much better to ...
sfdcfox's user avatar
  • 495k
3 votes
Accepted

Creating Generic Related List Lightning Component

I recommend using the Developer Console to look at the apex debug logs when encountering errors with your apex actions in lightning. In this particular instance I believe that you are receiving an ...
Kyle's user avatar
  • 1,190
3 votes
Accepted

Callback after the record was created using e.force:createRecord

Idea has been created regrading the Callback method for force:createRecord event to redirect or refresh after save:- https://success.salesforce.com/ideaView?id=0873A0000003V4hQAE You have to go for ...
sanket kumar's user avatar
  • 15.4k
3 votes
Accepted

When and why do I need to perform an .isValid() check?

I think you are not forced to use it if you don't want. The second warning seems like just a good practice information. It reminds you to use .isValid() because you might do something inside the ...
Renato Oliveira's user avatar
3 votes
Accepted

Dynamically set Connected App Callback URL

Your options: Update the callback URL via Metadata API called from your post-refresh script that implements SandboxPostCopy (example) Have the callback URL point to your VF page, then do the redirect ...
identigral's user avatar
  • 7,663
3 votes

Handle response value in UI from Callback function in LWC

Resolved the issue by using Arrow function in the callback. Arrow function refers to this variable correctly. const messageCallback = response=> this.opportunityValue = response.data.payload....
Somnath Paul's user avatar
3 votes
Accepted

LWC pass callback function dynamically

There are a few ways to accomplish your requirement as mentioned below. Please note that code snippets are based on the github repo you pointed out and hence, you'll have to tweak it a bit if needed. ...
arut's user avatar
  • 5,301
3 votes

Clarifying Refactor Lesson

David's answer is perfectly fine, but we can go a step further: we can make it so we can handle any server call in a condensed manner. This is a function that I use in all of my Aura components that I'...
sfdcfox's user avatar
  • 495k
2 votes
Accepted

Change the code to reduce callback

I usually create a factory/service and keep the controller as thin as possible.The main reason is, angular controller's main work is to maintain the ViewModel and rather than worrying about the ...
Praveen's user avatar
  • 10.1k
2 votes

Is there a clever abstraction to convert Lightning Component action responses to promises?

Promises are great and I've been promoting them internally at Salesforce for years. But they do not work well when you're building a reactive system and the metadata/data is not immutable. That is the ...
Kevin Venkiteswaran's user avatar
2 votes

Is there a clever abstraction to convert Lightning Component action responses to promises?

Yes, in my helper JS file I have utility function to provide me Actions as promises for this very reason. Snippet below and full code at https://gist.github.com/DouglasCAyers/...
Doug Ayers's user avatar
  • 4,196
2 votes

file upload in lightning do not call action callback

Having said the above on debugging the callback issue, i notice another trivial thing, adhering to the aura life cycle . fr.onload = function() { var fileContents = fr.result; var ...
Sumuga's user avatar
  • 2,159
2 votes
Accepted

Upload File Error

The code you used is out of date now, $A has been deprecated, you now need to use $A.getCallback() instead. I've not dug deeply into this, but pretty sure this'll sort you out: $A.getCallback(...
Matt Lacey's user avatar
  • 25.7k
2 votes
Accepted

Can we use package push upgrade functionality to push new callback url in the list each time

It is not possible to change the callback URL in the manner you mentioned for new package push upgrades. See this document where it states For your convenience, you can update some fields in a ...
Gaurav Kheterpal's user avatar
2 votes
Accepted

helper function undefined in helper after callback

you have syntax error in calling that.handleGetUpsCredential function. From its declaration I can see, that it accepts only one parameter, handleGetUpsCredential: function (component). Also passing ...
Oleksandr Berehovskyi's user avatar
2 votes
Accepted

Using Callback when calling server side function

The only way you could not use callbacks is if you were to hardcode the values into the component, but since you are getting a list of accounts, this is not possible. Every component on Lightning is ...
Renato Oliveira's user avatar
2 votes
Accepted

How can I decompose a Lightning Component Helper to escape deep nesting hell?

With thanks to @dsharrison, after working out a few other small bugs, I finally have the helper working as expected: ({ getCountryAlerts : function(component) { this.getFromServer(...
Brian Kessler's user avatar
2 votes

DML operations in the Apex callback method

I found a working solution for doing DML from a continuation method. According to the documentation for Continuation Limits, An Apex method that returns a Continuation object can’t perform Data ...
Zach's user avatar
  • 368

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