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
20 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
0answers
15 views

Is there any way to Obfuscated JS code of Custom Components in Force.com Sites?

I noticed that the Aura Custom Lightning Component's JS code is easily readable on the browser when the components are used in a custom public site. Is there any way to Obfuscate that JS code? I ...
0
votes
1answer
32 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
49 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
28 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
33 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
32 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
0answers
22 views

Close tab of lightning:recordEditForm from lightning component

I have a lightning component that I am opening through a related list by overriding New button. I used lightning:recordEditForm in lightning component to create and edit records of related object. On ...
0
votes
1answer
66 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
0answers
17 views

Javascript atob function is causing issue in lightning component in IE11

I am using JS atob function to ecode an attachment var billdetails = response.getReturnValue(); billdetails.Header.Notes = atob(billdetails.Header.Notes); this is working fine in chrome and edge ...
0
votes
1answer
37 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
22 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
24 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
34 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
96 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
33 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
18 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
215 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
23 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
32 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
22 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
329 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
18 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
15 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
0answers
223 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
29 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
38 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
0answers
14 views

unable to get the default value of radioInput in controller

In my aura component, I iterate through an list of elements and render as radio buttons and would had set the very last one to be selected by default, but unable to get this value of default in ...
0
votes
1answer
26 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 ...
0
votes
1answer
60 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
0answers
47 views

LWC container created on init call overriding all other LWCs already rendered with their own unique state

Situation: Up until Salesforce API got upgraded to 48.0 every time an agent would open a salesforce tab when opening a support case we were able to create a new aura:component that would trigger an ...
2
votes
1answer
117 views

Salesforce Aura Specialist Challenge 2 Error

Not able to find what's going wrong!! In Console.info I am getting this error. TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments ...
0
votes
1answer
165 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 ...
0
votes
0answers
16 views

Unable to render the view when the element is selected through code

I have a use case in a Lightning Component where I have to select the values in a dropdown by setting element’s selected property to true in the code as follows. options.forEach(function(element) { ...
1
vote
1answer
23 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
19 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
118 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
4k 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
64 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
137 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
0answers
47 views

Aura component controller JS copy <p> tag with html format to clipbord

I'm trying to copy all of the content from a p tag using javascript. It works, but it copies the text in one long line of text. I want it to copy with the format using the break tags, like if someone ...
0
votes
1answer
214 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
89 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
41 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
600 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
0answers
26 views

Leaflet event propagation and Salesforce Mobile

I am implementing a leaflet map for the salesforce mobile app. The problem is that touch events on the map are propagated up to the page itself. So when I pull the map down it scrolls the whole page (...
0
votes
1answer
591 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
0answers
117 views

Workspace tab is not refresh after closing subtab

I need to refresh the workspace tab after closing the current subtab. But it's not happening as expected. Below is my code. var workspaceAPI = component.find("workspace"); ...
0
votes
1answer
312 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
523 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 ...

1
2 3 4 5