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.

Filter by
Sorted by
Tagged with
0
votes
1answer
320 views

How to declare an account object in LWC js file [closed]

I'm new in LWC and javascript. Can you help me declare a variable account in Salesforce LWC js file. TIA.
0
votes
0answers
704 views

Callback failed Error for Lightning Aura Component

I am facing the below error for the Lightning component. I tried to debug but was not able to find the root cause. This page has an error. You might just need to refresh it. Error in $A.getCallback() ...
0
votes
0answers
216 views

Parameter to apex method is going as null when setting parameter in Lightning JS

I have an add row and save button on a table. When i click on add row, the row gets added and as soon i fill the data and then click on save button, it returns null. After looking into debug i ...
0
votes
2answers
264 views

How to sort Alphanumeric strings in a lightning:datatable on the client-side controller?

I have a field called Elapsed Time (Standard field from Approval Process) in a lightning datatable which is formatted as an alphanumeric string using a helper function. The original data received from ...
1
vote
0answers
291 views

How to update an LWC when a trigger updates a record

I have an existing LWC, we have a community page that holds it and one other LWC (which is part of a managed package we cannot control or edit). The managed component sends and receives data for ...
0
votes
1answer
512 views

How to pass selected picklist value (map) to lightning controller

I have a lightning component which generates picklist values from a map. How do I pass the selected value from the lightning select to the controller. I have the following but get: undefined on ...
0
votes
1answer
149 views

select few rows/all rows in pagination table and change value of a column in selected row

I have a pagination html table with checkboxes. I want to be able to select few rows or all rows in the 1st page and change the value of a column in that particular row/or all rows. js: myFunction:...
0
votes
1answer
342 views

setCallback returning error state for saving records to salesforce

currently I’ve been following the aura components module in trailhead, with the main variation being that I'm using the Opportunity object, and I’ve run into a road block. For some reason when I try ...
0
votes
1answer
268 views

Need To add the Button in the custom object List View Layout

I tried to add the button in the custom object list view. I've added the button in the search layout too but still the button is not visible in my custom object.can anyone help me how to resolve this ...
0
votes
1answer
2k views

Unable to capture data on onrowselection in datatable LWC

Unable to capture selected rows details in LWC datatable, here is code On selection passing selectedData is showing duplicate data in alert, I need to populate selected rows details(selectedData) in ...
1
vote
1answer
876 views

lwc Lightning Button not working

I have this simple conditional display of templates using lwc, but the lightning button I'm trying to use in order to change the view is not working. The button is shown when the component is rendered ...
0
votes
2answers
135 views

Variable Undefined...But it Really Is

I'm working in a Lightning Aura component, and when I run it in the browser it's saying that my element is undefined. HTML <div id="myElement"> ... </div> Controller.js ...
0
votes
1answer
361 views

Get aura:id and selected option value in controller for <lightning:select>

I have a dropdown in a table in a lightning component. Here is the code of that td. <tbody> <aura:iteration items="{!v.recipientList}" var="recipient"> <tr class=...
0
votes
1answer
572 views

LWC - how to refresh radio button group after handleEvent & Submit button completed?

I have an LWC component that displays a radio button group - on selecting an option it displays a message as to what processing will happen when the Submit button is clicked. On clicking the button, ...
0
votes
1answer
243 views

How to i fetch the ID Value from the JSON Stringify Response which i get after saving an Account record from a Lightning component?

I have the below Code in my Controller code var action = component.get('c.createAccount'); action.setParams({ ac : component.get('v.accountRecord') }); ...
-2
votes
1answer
24 views

Hi , I have a code from a website which moves a text from left to right. I want to stop and start the text by onmouse events

In below code , a text is moving. I want to control this text with the help of onmouseover and onmouseout events. Can anyone guide? Below is the code : <aura:component implements = "force:...
0
votes
1answer
44 views

i am trying to insert Contact details using lightning cpmponent but it showing error. here is my code

apex controller public class lightningContactSave { @auraEnabled public static string save(string firstName, string lastName, string email, string phone){ Contact con = new Contact(...
0
votes
0answers
200 views

How to run apex Aura Methods in sequence order?

I want to fetch current user profile in doInit method and based on that profile would like to call another apex controller aura method and set parameters. I am following below procedure, but I see for ...
0
votes
1answer
603 views

How to get pageReference on target Aura cmp init when being called from a different Aura cmp in a Community?

I've been stuck on this for a solid day now. I have a large package that need to deploy which uses 3 Aura components. They navigate to each other at various times using navigateToComponent. When I ...
0
votes
1answer
244 views

Lightning Component server-side request not returning custom object variable

The setup In simple terms, I am trying to call SOQL from a server-side controller and return a custom object record to the lightning component. The problem: This is failing in the lightning component'...
0
votes
2answers
20 views

LWC put string results from apex call into fields

I can't seem to get the individual values from my returned list - how do I do this please? What do I replace the ? for each field? The results returned will always only be these 2 fields. The Apex ...
2
votes
1answer
869 views

Getting results 'undefined' in LWC from Apex call

I've simplified my code drastically to try and get to the bottom of what's wrong, but I'm still getting the 'undefined' result and am at my wit's end. This is in my html which triggers the event: &...
0
votes
1answer
24 views

What's wrong in this , anchor link doesn't work and neither the onclick [closed]

content +='<td>\<a id="{v.payid}" onclick="{!c.details}"'+filecontentdata[j]+'>
0
votes
0answers
50 views

Why aren't created Opportunity Product

ElectronicCigaretteOpportunityComponentController.js createOpportunity:function(component, event, helper) { let action = component.get("c.createOpportunityMethod"); let store =...
2
votes
1answer
25 views

Why onfocus and onblur infinitely calls itself?

ElectronicCigaretteSearchComponent.cmp <aura:component> <aura:attribute name="soqlRequest" type="String" default="none" access="global" /> <aura:attribute name="listProducts" ...
0
votes
1answer
2k views

LWC update toggle checked/unchecked attribute from JS

First of all I’m new to LWC development so I would like to apologize if the question looks stupid. I’m currently working on a LWC and I would like to create 2 toggles but I want only one toggle to be ...
0
votes
0answers
197 views

Lightning component to update a field on the record

I am trying to replace the Javascript button to Take Ownership on the Case to a lightning component like below Controller ({ recordLoaded: function(component, event, helper) { var ...
0
votes
0answers
16 views

Why throwing the same product in Cart.has(product) it return false

Controller handleClickAddToCardEvent: function(component, event, helper) { let product = event.getParam("product"); let Cart = component.get("v.productCart"); if(...
0
votes
1answer
2k views

Invoke Visualforce Page Javascript Method From Lightning Web Component

I would need some help in invoking a Visualforce JS function from LWC. The LWC is embedded in the VF page as below: <apex:page controller="DataDisplayController" showHeader="false"> <apex:...
0
votes
1answer
199 views

How to assign value to global variable in Javascript with a button click?

Is there any way to assign value to global variable in salesforce helper javascript? Helper ({ resetTime: 30000, refreshNotif: function(component, helper) { window.setInterval( ...
0
votes
1answer
102 views

Aura component - Page scrolls back to the user clicked section

There is a custom Aura component at bottom of a page, user clicks a menu item in the custom component and a toast is shown along with the tab user needs to work at the top of the page, when toast is ...
0
votes
1answer
48 views

unable to get field value from database.query method

I am using database.query method to retrieve 2 fields from account. But when i tried to fetch get the values of that fields i am getting null value. Can someone help me. Here totalValueFieldName is ...
1
vote
1answer
359 views

Split records from the response.getReturnValue() to different objects like Account, Contact, Opporunities in the helper

From the controller i am returning list response, which it is having Account, Contacts, Opportunities. Attaching the response image. I need to split different objects data and assign it to different ...
0
votes
1answer
928 views

OpenTab with focus after closing some other tabs on Console Navigation Apps

I have overriden new Account and Edit Account standard actions with some custom Lightning Components. On console navigation apps i want to close some tabs on Account save and then open a new tab to ...
1
vote
1answer
39 views

Show List of Account Records and sort them according to selected button value (Multiple button can be clicked or selected)

I want to Show Records on the button Click Below Code is Working fine but i want to add Multiple button click check without Deselecting previous Button. In the above Picture if i select Hot it will ...
0
votes
1answer
28 views

stringified list of Orders-Parameter from JavaScript Controller not passed into Apex Controller

I want to pass a list of Orders from the JavaScript Controller into the Apex Controller. When I debug, I get a value for the list of orders in the JavaScript Controller, but the Apex Controller does ...
0
votes
1answer
916 views

component.set not setting attribute value from data.getReturnValue in action.setCallback

I am using this component: https://developer.salesforce.com/docs/component-library/bundle/lightning:map/ and instead of having a hard coded I am trying to grab the billing and shipping addresses from ...
3
votes
2answers
11k views

LWC: Inside an HTML template for-loop, set loop variable property to new user-typed input element value?

I'm trying to write a Lightning Web Component (yay, first one). Still in the "proof of concept; can I get user input to propagate around the page?" stage. I have a List<MyApexWrapperClass> ...
1
vote
0answers
392 views

Map - get key value in aura component

I'm trying to get the key/value pair in the aura component Aura component: <aura:attribute name="countryMap" type="Map" default="{}"/> <aura:attribute name="currentCountry" type="String" /...
0
votes
1answer
516 views

window.location.pathname alternative in Lightning Experience

In a Salesforce Community's knowledge article detail page, I am using window.location.pathname in lightning component controller to retrieve the page url (I want to later pass the url to the Apex ...
0
votes
1answer
291 views

Fetch Value from template tag in javascript in lightning web component

Please refer to below markup. <lightning-record-edit-form key={field.key} object-api-name="Callback__c" layout-type="Full" > <div class="slds-grid slds-wrap"> <template for:...
2
votes
1answer
167 views

Lighting Components: Dynamically Call Aura Method

Is it possible for a lightning component to make a call to the method in another component by using the name of its aura:method dynamically? Or can it only be hardcoded? e.g Child component: <...
0
votes
1answer
122 views

How can I save fetched JSON to a custom object's custom field. JSON parameters do not have same name as custom fields

On doing Something like this: o.FieldName__c = str[i].FieldName; //o instance of Custom Object and str is deserialized List. An error pops up showing 'variable does not exist: FieldName'. If I use ...
0
votes
1answer
1k views

Component.find not working for lightning:input

I need to enable the text boxes based on the value selected in combobox - Below Picture - Based on the Combobox changed I am trying to enable the corresponding input boxes, which is not working ...
0
votes
1answer
2k views

How does one populate a Lightning component combobox with a list of records (id/name)?

I have a Lightning component in which I want to display a list of records related to an Account. I currently have this (but it doesn't work): My Component display: <aura:if isTrue="{!not(empty(v....
0
votes
1answer
831 views

Displaying Parent and Detail Records in Lightning

this marks my first step at creating Salesforce Lightning pages and, I'm hoping to be encouraged. I'm able to print the value of acct in the MYAccount class so, I believe my Apex code is okay. ...
0
votes
1answer
803 views

Catch Quick Action event in Lightning web components

Is there any way to capture the event of a Quick Action in LWC? The Quick Action is applied on a picklist that when pressed, the picklist takes "x" value. This is the Quick Action in page: And here ...
0
votes
1answer
771 views

How to call a method in a lightning component in same helper

I have a delay function in a lighting component helper from which I want to call another function I get the error [this.displayToast is not a function] how do I achieve this? Delay function: ...
1
vote
2answers
2k views

Is it possible to "find" an aura:id within an aura:id?

I have a component where I am building a lightning:recordEditForm using fields based on a different field sets that looks a little something like this: <aura:component> <aura:attribute ...
0
votes
0answers
492 views

Does response.getReturnValue(); terminates the execution of controller function?

I am trying to get an attribute set to the value returned on using response.getReturnValue(); and a thereafter a Boolean checked to true in a controller function. This save function saves the record ...