Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [javascript-controller]

A controller is a JavaScript Object, created by a standard JavaScript object constructor. In the Aura Framework, the JavaScript controller is client-side.

0
votes
2answers
24 views

Salesforce Apex-controller server side won't run - Lightning Component

I'm having an issue where .setCallback is not functioning . Everytime I delete an account it doesn't work. Here is my attribute <aura:attribute name="deleteholder" type="String" /> and here ...
1
vote
1answer
23 views

Search not refreshing when input SearchText changes

I have a lightning component which lists a list of reports. Also a search Bar so users can search from the list. I am not using Apex to perform the Search using .filter within the js controller. But ...
1
vote
0answers
40 views

Add addEventListener for blur to lightning:inputField

I want to invoke a method when inputfield is off from focus state(blur). I am trying as below but i am not able to get the alert statement when the cursor is out of focus from field . Can some one ...
1
vote
0answers
41 views

Get event source from onclick handler in outer div

In my lightning components, I am trying to create a system that keeps track of every button that gets clicked inside my component. Having an event that fires whenever any button is clicked turns out ...
0
votes
2answers
38 views

Trying to execute 2 nested SOQLs, not getting the expected result

Here I am trying to filter the the records based on the output provided by the first soql, not getting the result I am looking for. public class DMLTest { public void DMLtesting() { List&...
-1
votes
1answer
18 views

toLowerCase method not working inside a filter method [closed]

I am trying to use toLowerCase method inside a filter method. For some reason it doesn't seem to work. Not sure what I am doing wrong here. PLz advise! mdu["aaUnits"] = allUnits.filter(x => { ...
0
votes
1answer
21 views

How to add items to lightning tree component through controller?

I am trying to add items to the lightning tree component through the controller js file on the click of a button. I already have all the data pulled in on the load event. What happens now is it just ...
0
votes
1answer
34 views

Compare fields in lightning component

I have a lightning component which the goal of it is to open a page if some fields on the record are not null, how to compare those fields to null? Here the component: <aura:component controller="...
0
votes
1answer
33 views

Extract values of the object received in the apex method!

I am passing in an object with mutiple rows of data, which eventually will be saved to the custom object. How do I extract the values of the object that I received in Aura enabled apex method. ...
0
votes
2answers
29 views

Set 'option' attribute of CheckboxGroup via Apex

So this is an example of what i need to know. Basically i want to set the option attribute of my lightning:checkboxGroup via apex I even tried with a Map instead of an Object in apex controller. ...
0
votes
1answer
29 views

Salesforce Lightning: ondblclick event not working on Select List box

ListBox.cmp <div id="div1" > <label for="picklist">Available Labels</label> <br/> <select style="width:100%" id="picklist" multiple="multiple" ondblclick="myFunction()"&...
5
votes
0answers
48 views

Passing a variable to lightning component through snapin chat

I have a snapin chat component embedded on our custom application (not salesforce or a community). I'm trying to allow a parameter to pass through to my lightning component for use in the prechat ...
0
votes
1answer
71 views

calling apex method without a return value from controller

I am trying to call an apex method through a controller. I have read somewhere the apex methods without any return should be prefixed with get. I am not sure what I am doing wrong here. It says cant ...
0
votes
1answer
15 views

Variable add on a Javascript controller inside -> component.find(' variable ') markup

I want to add a variable like this. Day value is an Integer var day = component.find('days').get('v.value'); var date1 = component.find('HDate'+day+'__c').get('v.value'); But it returns an error at ...
0
votes
1answer
17 views

Not able to push records to javascript array to use it in the component!

I am trying to push data in the controller variable to eventually push it onto the component attribute variable. As of the now the record gets pushed but it clears the previous record that was in ...
0
votes
0answers
30 views

Is it possible to set a value (in table) dynamically through lightning javascript event?

I have list of object records displayed in a table on lightning component. I would like to dynamically set a field value when another field value is changed. I should be showing the set value to the ...
1
vote
1answer
195 views

Simple Popover Example Causing: “Cannot read property 'na' of undefined”

I'm trying to get the popover example from the Salesforce documentation working and it's giving me an interupt error with "Cannot read property 'na' of undefined" message. All I have done is copy ...
0
votes
2answers
65 views

Parsing error: Unexpected token in below code of in Lightining controller

({ doInit : function(component, event, helper) { component.set(v.columns[ {label: 'Department ID', fieldName: 'DepartmentID', type: 'Auto Number'}, {label: '...
0
votes
1answer
25 views

How to send an arrayList from Apex to Javascript and then to HTML?

I'm new in JS and can't understand, what is wrong here (this is my test value, but then I want to send an arraylist's elements): Apex: public String test{get;set;} public String myApexMethod(){ ...
0
votes
2answers
66 views

How to retrieve the checkbox which were selected and deselected now -Lightning component?

I have a table where object records are displayed along with a checkbox. All the existing records are displayed with checkbox ticked. If the User deselects the checkbox on any of the rows I should be ...
1
vote
2answers
105 views

Does more logic on Client side reduces the lightning performance?

I am just struggling to understand on this as I develop a lightning component. I have object rows from apex controller which gets displayed on the component using <table>, <tr> and <td&...
1
vote
1answer
58 views

Unable to Call Apex-Controller Method in Modal-Footer Component

I have a modal with a footer. The footer is just for Cancel and Save buttons, and their respective JS functions. Modal Markup <lightning:overlayLibrary aura:id="overlayLib"/> <lightning:...
3
votes
1answer
86 views

Dynamic Button Icons in a Data Table Similar to Dynamic Actions in a Data Table

It's possible to have actions for each row in a data table that change depending on the contents of the rows (that are changed by those very actions). For example: The component reference provides ...
0
votes
1answer
20 views

Child component not displaying records from Parent record

I am passing the results from Parent component to Child component but the results are not displayed for some reason. I have gone through many example codes and it seems I have done everything ...
1
vote
1answer
83 views

Multiple calls to lightning:quickActionAPI getAvailableActionFields() fails

I get an error when doing multiple calls to getAvailableActionFields in a Promise.all(). The markup: <aura:component implements="force:hasRecordId"> <lightning:quickActionAPI aura:id="...
6
votes
1answer
75 views

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

I didn't write but rather I'm reviewing the following Lightning JS function: InitializeComponent : function (component) { var recId = component.get("v.recordId"); var action = ...
1
vote
2answers
33 views

Help Interpret Advanced Array Work in Lightning JS

I didn't write but rather I'm reviewing the following Lightning JS function: InitializeComponent : function (component) { var recId = component.get("v.recordId"); var action = ...
5
votes
1answer
355 views

How to get the display density in a lightning components controller?

Is it possible to see if a user is in Comfy or Compact display density in a lightning controller? This is a new feature since Winter '19 and I cant find any documentation about this.
1
vote
1answer
44 views

Lightning Application Event Seems to Refuse to Fire

Event: <aura:event type="APPLICATION" description="Event is fired when boat type is changed in the BoatSearchForm component" > <aura:attribute name="boatTypeId" type="String"...
5
votes
2answers
35 views

Extracting a callback function

I have the following code in my controller: doInit: function(component, event, helper) { // Create the action var action = component.get("c.getExpenses"); // Add callback behavior for ...
0
votes
1answer
164 views

lightning:recordEditForm, mark as missing a field that I'm passing

I have an Issue with this component. When every Try to submit a new OpportunityLineItem The component sends the following error messages. An error occurred while trying to update the record. Please ...
0
votes
1answer
37 views

Enque action of javascript controller in lightning not working as expected

I want to call action1 server call after action server call gets over while doing enque. Since its not a best practice to call consecutively. I called the action1 inside action as shown below. Which ...
2
votes
0answers
62 views

controller throwing javascript error

I have a very basic controller function which is for some reason throwing a Javascript error. HTML where controller is called: <lightning:button label="Apply" iconName="utility:magicwand" ...
1
vote
1answer
30 views

displaying loading gif until server returns response?

i am developing a lightning component and i'd like to find out how to adding a loading image. Inside my controller i have a fetch() function which will get a server response. How can i display a ...
0
votes
1answer
38 views

Not able to print out fields of custom object

In my client side controller, I call a server side action that returns a List of custom objects. Each of those custom objects has multiple fields attached to it. When printing the values in the ...
2
votes
4answers
772 views

Accessing Map Value in Lightning Component

I've been trying to access map values in Lightning Components, but haven't been able to be successful. I've searched the documentation, articles, this forum, etc and the answer seems to be that there ...
0
votes
0answers
43 views

Unable to call Server-Side Action

I am trying to just execute a simple query and return a map <Id,List<object>> to client side helper. The method just isn't making the call to server side. Any help is greatly appreciated. ...
2
votes
1answer
372 views

Passing sObject List from Client Controller to Server Controller (Lightning Components)

Seems like I'm not being able to pass a sObject list to my server-side controller. I've seen articles and other forum answers that propose using JSON.stringify. I've tried that method, but my server-...
2
votes
1answer
69 views

DOM modifications from controller in lightning

While reading this article I met the following rule: Do not modify DOM in Controller. If you modify DOM in Controller it will call renderer method which will end in no result. The article looks ...
16
votes
3answers
940 views

What are the outer parentheses in Lightning controllers?

In every Lightning controller you have these outer parentheses wrapping the actual object: ({ getInput : function(cmp, evt) { var myName = cmp.find("name").get("v.value"); var ...
1
vote
2answers
602 views

Make a JavaScript class from a different file accessible in the lightning controller

How could I make a JavaScript class from a different file accessible in the arbitrary lightning controller? I found this question from SO, but it does not help me. So, the best way I was able to ...
3
votes
1answer
347 views

Array.filter() in Lightning Components

I'm trying to filter through an array of objects in a controller using the JavaScript filter() method. I get an error, however, that says, Uncaught Action failed: c:QuestionIteration$controller$...
0
votes
1answer
185 views

Using a custom lightning component within a form as an input field

Newbie to salesforce. We have built a multi-select lightning component that allows the users to select multiple values (based on auto complete). Example allows user to select multiple contacts from ...
-1
votes
1answer
636 views

force:recordData not updating targetFields on reloadRecord

Working on the lightning component framework specialist superbadge, stage 6, and getting the following error: The BoatDetails component must use force:recordData to load the appropriate list of ...
1
vote
0answers
22 views

Wish to prevent agent closing tab in service console

I am trying to find a way to stop agents from closing their tabs in service console if they have unsaved changes in tab. I am using sforce.console.setTabUnsavedChanges to accomplish this. I know i ...
0
votes
2answers
1k views

How to iterate a list of sobject returned from Apex controller in Lightning JS controller

New to Lightning and trying to figure out how to process a list of sobject/custom metadata type records returned by Apex class in js controller before passing them to the component. Apex Controller ...
3
votes
0answers
139 views

Cannot read property 'appendChild' of undefined

I want to show the geoposition on a leaflet map lightning component. I enter an Id and get geolocation data accordingly. When I first enter an Id everything works fine, for the second time it shows ...
3
votes
1answer
343 views

unable to get index var from lightning:select option (undefined)

component.cmp <lightning:select name="Version" label="Select a version" disabled="true" onchange="{!c.itemsChange}"> <option value="">choose one...</option> ...
1
vote
1answer
609 views

Lightning component controller can't set pairs into attribute of type Map?

I have a lightning component that will display a long list of contacts (could be thousands), with a nested data table from a related object. That related data is editable, so I'll want to be able to ...
7
votes
1answer
93 views

Can we use the event's attribute “path” in Lightning?

I've been working on a pretty complicated component, and I've had all kinds of trouble simply trying to identify which element is currently being used. After all sorts of experiments, I found a really ...