Skip to main content
New
Stack Overflow Jobs powered by Indeed: A job site that puts thousands of tech jobs at your fingertips (U.S. only). Search jobs

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
1 vote
1 answer
1k views

Change field value in lightning component

I'm trying to change the value of the field Instagram_followers__c of my Influencer__c object in my lighthning component. It's a really simple component: a refresh button wich check the number of ...
0 votes
0 answers
23 views

$A.get('$SObjectType.CurrentUser.Name') is undefined

I am using a script in the head markup file in the experience cloud. $A.get('$SObjectType.CurrentUser.Email') works fine, but $A.get('$SObjectType.CurrentUser.Name') returns null. I tried debugging it,...
0 votes
1 answer
2k views

Update multiple record edit form records on single button click

I have a requirement where we need to submit multiple record edit form data on single custom button click. Below is my approach for the requirement. I need to save the record edit form data on click ...
0 votes
1 answer
825 views

Conditionally display html based on apex:variable

I've seen Conditionally Render HTML in Visualforce but it seems to handle the checking on the apex side then simply reference that when determining whether to display but I don't think I can do that ...
1 vote
2 answers
3k views

save two records in two objects with a single save button with lightning components

I have two objects: question and answer, in one form. the first 3 fields belong to the question object. dynamic form belongs to the response object. I created two actions in the client-side ...
0 votes
1 answer
992 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') }); ...
1 vote
1 answer
959 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:...
2 votes
2 answers
1k views

How to bind 'this' to a function?

In backbone js I used to bind 'this' to function, something like this, this.someFunction = this.someFunction.bind(this); I would like to implement something similar in Salesforce helper function. Is ...
2 votes
1 answer
842 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 ...
1 vote
1 answer
962 views

Is there any way of hide Navigational items in community upon User Profile?

I have been asked to hide tome tabs from navigation bar on Partner Community when the logged user is Community User. What have investigated so far: Create a custom theme and replace the the layout ...
2 votes
1 answer
52 views

User Name returning "null" at seemingly random instances

Okay this is a weird one. I have an aura component that I put on our user record pages that display that user's open opportunities. I pull the recordId from the URL, run SOQL to grab all open opps for ...
0 votes
1 answer
2k 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 ...
0 votes
0 answers
31 views

Subscribing to a Canvas App published event in an Aura Component controller

We have an Aura component that contains a Canvas App. The Canvas App uses the Canvas SDK to publish events. This is my Aura component's controller... ({ doInit: function (component, event, helper) { ...
0 votes
1 answer
1k views

We added the header Access-Control-Allow-Credentials to true

We load JS code by creating a script tag with dynamic src endpoint and append the script element into the page our src will call resource apex class (@RestResource) I know that Community domain is ...
0 votes
1 answer
991 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
1 answer
2k views

aura:if inside aura:iteration

I want to conditionally render each item in an iterating list. It has to check if each contact in the iterating list is included/contains in another list of contacts. How should I approach ? ...
0 votes
2 answers
2k 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
1 answer
96 views

Notify Aura component of a window.location change

It looks like once an aura components (that overrides the New button of a custom object) is loaded and opened, it does not stop running when the user closes it and navigates to other pages. In fact, ...
5 votes
2 answers
162 views

How to preserve string with newlines passing from LWC to VF controller for PDF rendering

I have a Lightning Web Component (LWC) which takes a text input from the user. The text input is entered via a lightning-textarea, i.e. can also contain text with newlines. The LWC contains an iframe ...
0 votes
1 answer
478 views

LWC - lightning-record-edit-form 'onsuccess' Method Only Triggering Once

I have a LWC to replace the standard New button on the Opportunity object. This LWC presents the user with a lightning-record-edit-form so they can input the Opportunity details. They can then either ...
5 votes
2 answers
11k views

How do you set a default value on lightning component force:inputField which is a lookup?

I have a lightning component (Summer 16) which contains a "Task" attribute as follows: <aura:attribute name="task" type="Task" default="{ 'sobjectType': 'Task' }"/> Further down the page, ...
0 votes
0 answers
25 views

Value set from JS controller does not reflect on CMP file

I am working on a functionality that hides a button and uses a wrapper for assigning a value (ex. wrapperClass.showButton = false). I checked the Apex debug and it is setting the wrapperClass....
0 votes
1 answer
193 views

LWC issue with array variable being blank when accessed from another function

I am building a custom file upload component as follows. I prepare my list of uploaded files inside the function handleFilesUpload. I then call another function called handleSaveFiles but inside of ...
0 votes
1 answer
272 views

How do I calculate expression inside an LWC iterator?

I have an iterator rendering a list, simplified markup shown below: <template for:each={cells} for:item="cell"> <template lwc:if={showOption1}> ... </...
16 votes
4 answers
28k views

Get records in Lightning web components without APEX

import { LightningElement, track, api, wire } from 'lwc'; import { getRecord } from 'lightning/uiRecordApi'; const FIELDS_SOLICITUD = [ 'DCABM_obj_solicitudABM__c.DCABM_fld_aplicacionSolicitud__c'...
0 votes
1 answer
361 views

Javascript "getElementById" return null in Visualforce Page

Anyone help me, why Javascript "getElementById" return null in Visualforce Page. In my form, I have "Radio button" and "inputtextarea" My requirement is whenever click ...
-2 votes
2 answers
68 views

Sort Country picklist fetched using wire method [closed]

I have fetched country global picklist using wire method in Javascript. I need to put United states as the first value in the picklist. How should I sort the values written by wire method. @wire(...
1 vote
1 answer
3k views

Aura Component Field Validation Error

I am tryin to handle field validation for a lightning:input field in a custom aura component. I've referenced the validating fields documentation with no success. I find my lightning:input component ...
1 vote
1 answer
133 views

Evaluating multiple record criteria in a loop

I am trying to loop over a returned list of records from a query and set several variable once I find the correct criteria. The struggle I'm having is that the criteria I'm want to find can exist over ...
2 votes
1 answer
2k views

LWC get field value from @wire result (single object) from apex query

I've searched for an answer but found none. The answer is probably simple, but I'm tired of trying and not finding a solution! I need to access the fields returned from the query. It does not return ...
4 votes
3 answers
2k views

Spread Operator Usage in LwC

I have a javascript related question. I have the piece of code using a spread operator var arrObj = [{ name : "m"}, { name : "mb"}]; var arrObj1 = [...arrObj]; console.log(arrObj1);...
0 votes
2 answers
479 views

A conditionally executed single line should be denoted by indentation

In a javascript file, I get the indentation code quality error: closeComp() { const selectEvent = new CustomEvent('hidemodal', { detail: true }); this.dispatchEvent(selectEvent); } ...
1 vote
1 answer
99 views

How to replace time part of DATETIME input by value from TIME input

I've tried to find an algorithm (Salesforce, aura) but without success. Probably, you have any ideas! I have: attribute <aura:attribute name="bulkApply" type="Map" default=...
1 vote
2 answers
6k views

Generate and download PDF file from Base64 Encode String

I want to create a LWC to download a simple PDF file with a random string. Here is my code: Apex Class: public with sharing class PdfLwcController { @AuraEnabled public static String ...
1 vote
1 answer
732 views

Nested Array: Filter on a String [] /Map doesn't return results as expected

The below lightning component renders data as parent-child fashion. When user search for a particular carrier name/provider it has to display only that carrier/provider data underneath. Problem is i ...
0 votes
2 answers
2k views

lightning-input type=datetime [Unable to set / consider the locale time for the validation as per the Locale of the User]

.html snippet (LWC Component) .js snippet (LWC Component) import { LightningElement, track } from 'lwc'; export default class DateTimePickerLightningInput extends LightningElement { @track today; ...
0 votes
2 answers
3k views

How to display an account owner NAME instead of Owner.Id in LWC

Please, someone help me to display an Owner Name in LWC datatable instead of Owner Id. I have this apex controller and js code Controller public with sharing class AccountLwcTableController { @...
0 votes
1 answer
62 views

Salesforce Aura Component Tip

Is there a way to see Aura component and its js controller in production org? I don't have access to developer console.
0 votes
1 answer
44 views

Summery table lightning component

I am trying to built a summery or pivot table in lightning component. Currently I am getting repeated values inside my table, not the actual ones. Response inside .js is like this: { "Short ...
2 votes
1 answer
6k 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 ...
0 votes
1 answer
195 views

How to remove asterisk from the LWC form

I want to remove addition asterisk I think it because I disabled country. Any inputs please <lightning-input-address street-label="Street" city-label=&...
1 vote
0 answers
124 views

Refresh all aura attributes(entire component) based on an action

I have a aura component that opens when we click on a button. Inside this component, when I do a certain action, the entire component needs to reload, basically I want all the aura:attributes to be ...
1 vote
0 answers
207 views

How to programmatically change the checked status of a lightning:input checkbox?

I have a toggle in my cmp and I'd like to be able to switch it back off in case of need. (I.e some error happens) in my cmp file: <div class="animals_container"> <aura:...
0 votes
1 answer
645 views

Unescaped Attribute Value XSS - how to sanitized event handlers in lightning aura component

How do we sanitize variables/controller calls [v.onRepeat/c.controllerCall] used in onclick/onchange events as per SonarQube standards. Here is the sample code : Issue 1 : <lightning:buttonIcon ...
0 votes
1 answer
621 views

LWC: How to add integer value into an array in JS controller which is bound to the data property of lightning datatable

Let's consider the below scenario: I have a scenario to bind integer value which is calculated from apex function. I have to display integer value in lightning datatable column. Please find the code ...
1 vote
1 answer
208 views

Salesforce Aura lightning:checkboxGroup

I have an existing Aura component that I need to add some help text to. I have a lightning:checkboxGroup that I need to add some help text to one of the options. The code is below. What I need to do ...
-1 votes
1 answer
228 views

What does FIELD_INTEGRITY_EXCEPTION mean?

when I try to save my aura controller this pop up doesn't allow me to save it Failed to save demo.js: Failed to parse CONTROLLER for js://c.demo: org.auraframework.util.json.JsonStreamReader$...
0 votes
1 answer
669 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 ...
0 votes
1 answer
563 views

Vf Page Using datepicker JS calender

VF Page- <apex:page showHeader="false" controller="Test4"> <apex:stylesheet value="https://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <apex:includeScript ...
1 vote
1 answer
435 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* ...

1
2 3 4 5
7