We’re rewarding the question askers & reputations are being recalculated! Read more.
5

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() { Map<String,String> strMap = new Map<String,String>(); strMap.put('a',null); strMap.put('b','Test'); return JSON.serialize(strMap);...


5

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.CampaignID__c"));


5

Fixed using this approach. In Java script Callback, var actSave = component.get("c.saveDataDML"); actSave.setParams({ "listToSaveString": JSON.stringify(itemList) }); and in Apex Controller, Deserialized an casted as below. @AuraEnabled public static List<Wrapperclass> saveDataDML(String listToSaveString){ List<...


4

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 remote action expects two parameters and one of them is passed as undefined. This will result in the same error. The reason you get it in this specific case ...


4

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 to change the name of your javascript method to be different to the apex method


4

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 returns. Call a server-side action from a client-side controller using callback. Note that you can register a callback for an explicit state, or you can use '...


4

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 action ) can lead to hard-to-debug issues. In debug mode, the framework logs a browser console warning about the clashing client-side and server-side action ...


4

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, by changing "jewishEducator:": jewishEducator to "jewishEducatorString:": jewishEducator should do the trick. One last thing, ensure that your variables ...


3

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 Lightning Event or a Lightning Callback in order to let the framework know that you're modifying the component or trying to invoke an action. You can read more ...


3

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 use native Lightning code for this purpose.


3

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 error with your query at this line of your apex controller: string queryString = 'SELECT id, name' +queryfields+ ' FROM ' +objectName+ ' WHERE ' +lookupField+ '...


3

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 callback that is resource-intensive or difficult to un-do, or something like that. The Trailhead text states that: This function checks that its parent component ...


3

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) { var warning = component.find('warning'); if (data.error) { <-------------------------HERE! data does not exist component.set("v....


2

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 business logic it has to perform after fetching the records. It is recommend to move most of the post logics(big ones) to the factory/service which improves clarity,...


2

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 case with Salesforce: effectively all metadata and data is mutable. Actions, including storable actions (https://developer.salesforce.com/docs/atlas.en-us....


2

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/13db5714c3cae0cbcacd252fba8c127a#file-controller-js-L2 callAction : function( component, actionName, params ) { var helper = this; var p = new Promise( function( resolve, ...


2

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 base64Mark = 'base64,'; var dataStart = fileContents.indexOf(base64Mark) + base64Mark.length; fileContents = fileContents.substring(dataStart); ...


2

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(function() { $A.enqueueAction(action); })();


2

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 connected app and the changes apply immediately to all installed versions of the app. For example, connected app descriptions are immediately updated in each ...


2

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 Custom Lightning Component with same functionality without using e.force:createRecord and you will be able to Callback after the record was created like:- // ...


2

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 callback function to the function have syntax error that.handleGetUpsCredential(component)(function (credential) {. It should be that.handleGetUpsCredential(...


2

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 thought to have great performance for the user, doesn't matter if the server response takes too long to show up. When you access a page like Process Builder, ...


2

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(component, 'getWeatherAlerts', this.displayWeatherAlerts); }, getFromServer: function(component, serverMethod, callback) { component.set('v....


1

Unfortunately there is no such event available in force:createRecord If you want to achieve this you need to create your custom lightning component which will do the similar functionality and then you can handle the behavior.


1

If you still prefer Promise API for your actions, you could try Lax service component - https://github.com/ruslan-kurchenko/sfdc-lax It provides easy to use API to call server-side actions with Promises, you can call one action, chained actions or even list of actions at ones. Below is a simple example of chained calls: component.lax.enqueue('c....


1

Might it simply be because of this line: Console.log("Begin callback"); Console.log() should be console.log() -- case sensitive. Console.log() will throw an exception (Console object does not exist) and the rest of the code in your callback will not be executed. Also, is the comment you pass to the Apex controller the actual comment you want to delete? In ...


1

The event "e.force:showToast" works in one.app container only.Hence you need to drag and drop this custom lightning component in the lightning app builder post which you can use it.Please refer to below documentation stating the limitation and details of this event https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/...


1

As pointed out by Vignesh Toast Event would run only on Lightning Experience/SF1 I created a SPA using Lightning App Builder with the above component with some minor modification like "flexipage:availableForAllPageTypes" on the component so that it can be used in App Builder. Another mistake I did was regarding case sensitivity of sobjectType . It'was ...


1

You have to handle the logic for input select options only through JS controller. Something like this: I am assuming loadCustomItem function is called on init of the component. Reform your setCallback to this: var state = response.getState(); if (component.isValid() && state === "SUCCESS") { component.set("v.item", response.getReturnValue()); ...


1

Haven't tried it but a quick Google revealed this Premote GitHub project that offers: Javascript Remoting in Visualforce has an ugly api. Premote fixes this by letting you wrap your Remote Action calls in a promise based on Q. As you may already know, using promises allows the deeply nested callbacks to be flattened and other things like parallel ...


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