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
0answers
24 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
24 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
22 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
9 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
21 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
29 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
28 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
48 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
0answers
39 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
votes
1answer
60 views

I am getting Error at the time of saving the record using page reference to navigate to standard application, Please help

Controller - appNavigation : function(component, event, helper) { var action= component.get('c.getAllApps'); console.log(action); action.setCallback(this,function(response){ ...
1
vote
1answer
22 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
18 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
30 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
1k 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
32 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
66 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
31 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
170 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
64 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
24 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
307 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
24 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
354 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
65 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
141 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
0answers
18 views

How to copy js object from one variable to another

I have a problem in javascript controller while assigning response. I have response "response.getReturnValue()" from setCallback function which is a list of records. I want to assign this to 2 ...
0
votes
1answer
309 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
205 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
482 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
165 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 ...
6
votes
1answer
1k 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'...
1
vote
1answer
209 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 ...
6
votes
1answer
308 views

eval() in Lightning Web Components

This code works in JS <script> let object_1 = "value"; window.console.log(eval("object_" + 1)); </script> But I try to do it in LWC and I get the error that the variable is "...
3
votes
1answer
70 views

Simple Apex controller function never executing

I have a standard Aura Lightning Component with onChange handler, Javascript controller and Apex controller but even though everything seems to be fine, the server controller method is never called. ...
0
votes
0answers
153 views

How to set custom error messages in lightning:recordEditForm [duplicate]

I am using lightning:recordEditForm to populate specific fields in lightning component. I am also able to validate user entries by fetching field values using aura id. Is it possible to set custom ...
4
votes
2answers
2k views

The first parameter of loadScript() and loadStyle() must be an LWC component

I have a strange problem with the component and I don't know what more can i do, I'm having this problem whenever I put the lwc inside the recordPage of a custom object but in a standard recordPage ...
2
votes
2answers
2k views

How to load and use external library?

I don't know how to use the library of Pagination in a lightning web component but I can't use the example method: $('#demo').pagination({ dataSource: [1, 2, 3, 4, 5, 6, 7, ... , 195], ...
1
vote
1answer
59 views

Pagination error

I want to do a paging, but I'm having some problems. When I select the page number in pagination, the "selected" class is applied to the position and not to the number itself. My HTML: <template&...
7
votes
1answer
2k views

How to access child Web Component property from parent Aura Component controller?

I have an issue working on integration between Aura Component and Lightning Web Component. I have one nested Lightning Web Component in an Lightning Component. When I try to access the child I get ...
0
votes
2answers
1k views

Lightning Controller window.open();

When I use window.open(); in my lightning controller, it opens the URL but at the end of the salesforce's url. It does open in a new tab which is what I want but the url is confusing me. For example, ...
0
votes
1answer
129 views

How to use Array.map() in Lightning Component JS File

I was going through this blog to understand foreach loop, but the blog says that use of Array.map() is more efficient than for foreach. So, I tried implementing that in my Lightning Component, but it ...
0
votes
0answers
27 views

Copying fields data when checkbox is checked in multiple rows(Visualforce Page) [duplicate]

I have challenge I'm working on a visualforce page I want whenever the checkbox is checked I want to copy the values into input text fields in visualforce page. So here I have multiple rows and ...
1
vote
1answer
2k views

Unable to get values of selected elements in lwc js controller [closed]

I'm developing a Lightning Web Component, which has the add & delete row functionality. Each row contains 1 input text & 2 picklists. I want to capture the value of all the rows i.e input ...
0
votes
2answers
320 views

Need to get the key of an Object Array given a Value

I have a registration process that differs from each record type, I need to get the recordType Name (or label in this case) so I can give proper flow to each user. The record type selection is made ...
0
votes
1answer
945 views

Use force:navigateToURL to open new window instead of new tab

When I use force:navigateToURL, it opens the URL in a new tab. Is there anyway to force this to open in a new browser window instead? Thanks in advance, code pictured below var urlEvent = $A.get("e....
0
votes
1answer
65 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 ...
3
votes
2answers
1k views

Multiple lightning:recordEditForm

I have a quick way of entering multiple records where user can add rows(record) to add. I am using lightning:recordEditForm component in aura:iteration. When i add multiple rows everything is working ...
2
votes
2answers
876 views

jsPDF in Lightning component: get blob in Apex controller

I'm trying to use the library jsPDF on a lightning component. The lighting component handles the creation, and needs to pass it to my apex controller (in order to save the file in Salesforce). ...
1
vote
1answer
487 views

How do I populate a Lightning:combobox with content from a map?

I've generated a map in my apex controller which I would like to use to populate a combobox. Simplified code below: Component: <aura:component controller="myController" implements="force:...

1
2 3 4 5