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
0 answers
21 views

How to close LWC Quick Action when the page is refreshed?

I have a quick Action button on Account page which is calling the LWC lightning-quick-action-panel component. By clicking on the quick Action button a model box opens, now when I refresh the Account ...
user avatar
0 votes
1 answer
35 views

For loop with in another for loop in aura javascript causes performance issue how to overcome on this issue

Here is the code snippet where my filterList is original list contains 300 records data and newList contains the selected list values which an 165 as example as below for loop causes an performance ...
user avatar
  • 1
1 vote
1 answer
22 views

Converting native javascript code to aura component javascript

I have the following JS code and I'm trying to convert to aura component JS Controller, I'm getting error on the yield how would you make equivalent aura component code function* ...
user avatar
0 votes
1 answer
20 views

Lightning Aura Component with external MailGo JS Library for mailto links

I'm an experienced back end java developer, but newer to Salesforce and front end development. I'm trying to implement this MailGo JS Library to handle our :mailto links a little prettier than just ...
user avatar
0 votes
1 answer
42 views

how to reduce lines of code in LWC

in my LWC project have a function per button, and I want to reduce lines and functions using a switch for the buttons. all function buttons are equal and i try use a switch, but I don't know how to ...
user avatar
  • 19
1 vote
2 answers
29 views

Reusing call back functions in Lightning

I have two Apex methods "c.getStudentGrades" and "c.getStudentAverage". They both reference the same table and use the same ID but the returned results are different. I'm trying to ...
user avatar
2 votes
1 answer
53 views

Reduce the number of chainings in AURA

I am new to Aura, and I am stuck on how to proceed with the task given. Actually, in the Init method, there are many chaining that should be optimized. My controller class doInit: function (component, ...
user avatar
  • 23
0 votes
1 answer
437 views

How to get unique values from result list in LWC

I have one list method like below @AuraEnabled public static List<String> getDetails(String AccName){ listacNameList = new list(); List accList = new List([Select Id, Name from account ...
user avatar
  • 7
2 votes
1 answer
33 views

How to remove sf form warning

I have this lightning component recordEditForm - <lightning:recordEditForm aura:id="crearAgenteForm" recordId="{!v.recordId}" onsubmit="{!c.handleSubmit}&...
user avatar
  • 23
2 votes
1 answer
81 views

Enable to iterate an array

Hope you guys are safe and doing well. I'm new to Salesforce Development and trying to iterate an array but enable to do it. I want to display 7 input fields. While opening the org I'm getting the ...
user avatar
0 votes
1 answer
646 views

Getting error [Cannot read properties of null (reading 'selectCheckbox')] onclicking the LWC component

I'm getting the below error Error screenshot : I'm trying to retrieve checkbox options from a child component through the parent JS but I'm getting this error. I'm new to JS and lightning so can you ...
user avatar
0 votes
2 answers
58 views

Aura Redirect Component Only if CustomerID is not Null

I wrote code for an Aura Redirect Component but I'm having trouble getting it to redirect only if the CustomerId is not null. Here's my code. Apex Controller public with sharing class NetsuiteQuote { ...
user avatar
0 votes
1 answer
28 views

How can I get "pattern"attribute from component (html) to Controller (javascript)?

How can I get "/ˆ[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,6}$/" in the Controller class? <label for="clientEmail">E-mail</label> ...
user avatar
  • 123
0 votes
1 answer
19 views

Populating date on e.force:createRecord

I'm trying to populate the last day of the year on the CloseDate (Date) field. I've tried everything from this link: https://stackoverflow.com/questions/13255114/retrieve-the-last-day-of-the-year-in-...
user avatar
0 votes
1 answer
567 views

How to get the uploaded file's size when using lightning-file-upload?

I've tried the following but it returns 'undefined. event.detail.files[0].size
user avatar
  • 564
0 votes
1 answer
880 views

window.addEventListener is fired multiple times

Receiving data via addEventLister to my aura component and do some actions based on it, refer to the code below: window.addEventListener("message", $A.getCallback(function (event) { try{ ...
user avatar
  • 308
0 votes
1 answer
32 views

Fetching User Info in Lightning Component

I'm trying to create a Lightning Component to integrate Sendbird into Salesforce by following this guide: https://sendbird.com/developer/tutorials/how-to-integrate-sendbird-with-salesforce I've ...
user avatar
0 votes
1 answer
129 views

How to capture the changes happened to the LWC component

I have an LWC component in which I'm displaying list of records in table format. I've implemented auto save functionality as well. When the current user is working in the component and at the same ...
user avatar
  • 29
0 votes
0 answers
32 views

How to check if the user is inactive for a while in LWC? [duplicate]

I have an LWC in which I'm displaying the list of records in table format(HTML table). It has text, text area, date, picklist, lookup data type in it. I want to call apex class and perform DML if the ...
user avatar
  • 29
0 votes
2 answers
54 views

Passing a variable into a get function in order to set dynamic CSS

I would like to have a dynamic CSS where the font color get red if the data exist; I am using a loop function in my HTML in the following way: <template if:true={fulldata}> <...
user avatar
  • 281
0 votes
1 answer
29 views

Close child Visualforce page from parent visualforce page

We have a child visualforce page that opens from parent VF page using standard controller. We enter some values that needs to be updated back to parent page and close the child VF page. We want to ...
user avatar
  • 55
0 votes
0 answers
47 views

Trying to insert 2 records in 2 custom objects which AREN'T in a Relationship via Lightning Aura Component

I am trying to create a record in 2 objects at a time. Object 1 = Guest_Master__c Guest ; its fields =Guest_First_Name__c, Guest_last_name__c, Guest_email__c, Guest_phone__c. Object 2 = ...
user avatar
0 votes
1 answer
120 views

How should I escape the comma "," while forming the URL in lightning aura component

In my lightning aura component: I am using below code to open a pop up for New user record creation and I am passing default field values to be pre-populated from another object, I am able to get the ...
user avatar
0 votes
1 answer
181 views

Apex method's callback Response.state is 'undefined' when calling function from lightning component's controller

I am new to Apex and Lightning so what I am doing may not be the correct way to accomplish this task. I am building a custom lightning component (CreateNewMailDrop.cmp) with a button. The button click ...
user avatar
0 votes
1 answer
43 views

Drag Drop records in canvas giving error Aura lightning

I am trying to display all records in a card format and trying to drag and drop it in a canvas. When i am trying to drag an element its giving the below error <aura:component controller="...
user avatar
0 votes
1 answer
47 views

Information about event in JS controller in AURA

I would like to know where I can get relevant information about the methods that have the event of the aura controller, i.e. this my_function: function(cmp,event,hlp)... I know a lot of the others, ...
user avatar
0 votes
1 answer
106 views

How does finding nested aura components work?

In my team's code base, there's code of this structure: function() { const first = component.find( 'level-one' ); if ( !$A.util.isEmpty( first ) ) { const second = first.find( 'level-...
user avatar
1 vote
1 answer
76 views

having issue in lightning:input, using this button for uploading file, and want to set null in button without refreshing page after class response [closed]

.cmp <lightning:textarea name="description" required="true" label="Description" ...
user avatar
0 votes
2 answers
698 views

Unable to pass an array from parent LWC to child LWC setter method

Trying to pass a array value from parent component to child component using setter method in child LWC but empty value is being passed to child setter method. I am Using parent LWC as a quick action. ...
user avatar
-1 votes
1 answer
53 views

unable to delete from json array [closed]

I have a JSON array and an array of IDs that needs to be deleted from the JSON array. I have tried to do with iteration but there is always something left in the JSON array. Controller: console....
user avatar
  • 295
0 votes
1 answer
1k views

Trying to take make fields mandatory `lightning-input-field`

I'm trying to make fields are mandatory to fill, but its not working with lightning-input-field How to achieve it with lightning-input-field <lightning-record-edit-form object-api-name="...
user avatar
1 vote
1 answer
181 views

Lightning Component - Attribute loses value

I have a Lightning Component that displays some Categories and the Offers per Category. I want to achieve "Search" in those Categories at first and then at offers. So, what did i try to do: ...
user avatar
0 votes
1 answer
376 views

Aura Component not working as expected

I'm very new developer and I'm stuck. I'm trying to adapt an Aura Component that I found on internet to my needs, but I can't make it work (The original I found works fine). Basically what I want is ...
user avatar
0 votes
1 answer
97 views

Update record on server using lightning component

may I know why this code does not change/update the field object data? By default, the field object (Final_Approved__c) is false. The type is a checkbox. This code is in lightning environment js. ...
user avatar
  • 23
0 votes
1 answer
78 views

value from javascript-controller to be used as global variable in apex controller

i want to pass a string from my javascript-controller to apex controller so that it can be used as a global variable(string) in Apex controller below is the code {.....user is selecting a group name ...
user avatar
  • 47
0 votes
2 answers
294 views

execute apex code from a aura component

Im trying to create a group in a chattool using aura component in salesforce. when i run the code for creating a group in developer console it runs fine. But i want to to execute when user press a ...
user avatar
  • 47
0 votes
1 answer
609 views

How do I convert an object to an array?

I have a searchContact method in the helper. I get from the component a list of contacts of type object and try to convert it to an array. I want to be able, after conversion, to refer to each element ...
user avatar
0 votes
1 answer
36 views

Why isn't the list data being converted?

I have a method that gets a list of data from a database, transforms some fields and outputs them to a table. //helper getDataFromDB : function(component, helper){ let action = component.get('...
user avatar
1 vote
1 answer
372 views

getParam("outputVariables") return undefined

Im using an aura component as an action button to display a flow on lightning experience. At the end of the flow I need to redirect the user to the new record created in the flow. COMPONENT <aura:...
user avatar
0 votes
0 answers
37 views

Object's field value into an aura component

I am not very familiar with aura component. How I get the value of a field into an aura component (more exactly, inside the controller .js of a component)? (Es: status of case) Thanks in advance :)
user avatar
4 votes
1 answer
343 views

Set dynamically Lightning Component Attributes

Currently I develop a Lightning Component, which should show record details based on specific record field values. Therefore I want to set dynamically component attributes based on some record values. ...
user avatar
0 votes
1 answer
68 views

Aura Component / Controller.js debugging : custom follow / unfollow button for Knowledge Article

I have created an aura component to allow client to follow /subscribe to an article. When a user clicks on the button subscribe, a record is created in Salesforce /Record created in Salesforce/ ...
user avatar
0 votes
1 answer
90 views

Create record from view in background

I currently have a lightning component from which I want to save a string into a record. In my javascript controller I create a record when a button is clicked. A dialog is shown to save the record ...
user avatar
  • 2,066
0 votes
0 answers
128 views

Get DOM elements to hide an element from afterRender event in Lightning component

I am trying to access Page related DOM elements which are not part of aura component. I am trying to access elements with the help of afterRender. I am able to get the element but i can see only proxy ...
user avatar
0 votes
1 answer
134 views

lightning:input update time value

I have two time inputs for start and end times: <lightning:input type="time" name="startTime" label="Start Time" min="05:30:00.000Z" max="19:00:00.000Z&...
user avatar
  • 632
0 votes
0 answers
82 views

Rich text Area Issue- Apostrophe converting to some html tags

How to remove the html tags and get the original content in lightning because in classic it appears correctly but when i switch to Lighting it is adding &" something whenever i am writting &...
user avatar
1 vote
1 answer
3k views

Default a dynamic value in Combobox onload LWC

I am retrieving a set of values from apex through JS, I want to preselect the the first option in the Lightning-combobox (the retrieved values are different for different users). I used @track ...
user avatar
0 votes
0 answers
378 views

Create Account record with image using Lightning component

I have made a component which will create the Account records, i want to upload image as well along with the rest of the fields while creating the Account record. i tried Lightning:fileUpload, but it ...
user avatar
0 votes
1 answer
101 views

Can anybody suggest me how to implement jquery sparklines in LWC

I have Loaded jquery sparklines static resource downloaded from https://omnipotent.net/jquery.sparkline/#s-news still i cant use functions in it to implement sparklines in LWC this is my html code <...
user avatar
2 votes
1 answer
458 views

Does javascript controller differentiate between double or single quotes?

My JS controller works completely fine when I replace single quotes with double quotes. Does it take both under consideration? Is it just a coincidence? Just wanted to confirm.
user avatar

1
2 3 4 5 6