We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [lightning]

This tag is for questions related to the "Lightning Experience" which comprises a number of elements around a new User Interface on the Salesforce Platform. While it can still be used in a server side MVC environment, it is primarily a MV UI where the Controller is JavaScript based operating from the user's browser. Lightning "Pages" are single page applications.

Filter by
Sorted by
Tagged with
48
votes
2answers
32k views

What are the available $A JavaScript functions in Lightning?

The Lightning Components Cheat Sheet lists a few common $A functions and the Lightning Components Developer Guide references some others that are useful for certain situations. I can view the $A ...
43
votes
2answers
6k views

Lightning Experience: How to prevent the display of obsolete data?

In many cases I've seen that LE is not displaying recent changes made in Setup immediately like in Salesforce Classic, but somehow cached or delayed. Yesterday I found an easy and perfectly ...
39
votes
2answers
14k views

What is suggested approach to transfer VF pages to be lightning ready

So I am planning to transfer our current VF pages to lightning ready. Most of our VF pages are based on a standard controller or standard set controller and use an extension. And they are pretty much ...
30
votes
3answers
5k views

How to build custom UI that works both for users that have opted in to Lightning Experience and users that have not?

This isn't a question about the pros/cons of Lightning/Visualforce, but is a question about how to build custom UI for the period of time (a year or many years?) where some users/orgs have Lightning ...
26
votes
1answer
3k views

Lightning experience page rendering is slow

I've developed a lightning component(actually about 4 sub-lightning components all included on a main component) that queries for records, displays them to a user, and has a form for contact ...
25
votes
2answers
2k views

Do promises work in Lightning?

I wrote some code that uses promises. It seems that in the Promise environment, I can queue an action, and the action callback is never called. In the callback environment, when I queue an action, ...
24
votes
3answers
6k views

Get file from Lightning input type file

With the Spring 17 release one of the new change on the markup is the introduction of the type file to the lightning:input, however I can't seem to get the file back, only a fakepath with the name of ...
23
votes
2answers
5k views

How to navigate in lightning out?

Actually I am using lightning components with a visualforce page, because this is the only way to override standard button (using VF) today. The problem is that, i need to redirect my user to the new ...
22
votes
1answer
3k views

When to use {#v.attrib} vs {!v.attrib}?

I have seen some uses of {#v.attrib} in a few of lightning components, and I'm a person who is used to {!v.attrib}. Is there a difference between them or is there a scenario where '#' has to be used/...
22
votes
3answers
1k views

force:navigateToComponent not loading component in Summer '17 | DOM repetition issue in Summer '17

I'm using force:navigateToComponent to navigate to a different component on click. On the first click, it navigates to the component and everything is successfully loaded. When pressing back button ...
21
votes
2answers
6k views

Infinite Loop Caused by Controller Action in Lightning Component

the following code is causing an infinite loop in my lightning component when I click the ui:button. Checking debug logs, nothing ever goes to the apex controller. .cmp layout <aura:attribute ...
21
votes
3answers
18k views

Lightning App - getting URL parameter

We are planning to convert some of our VF pages to Lightning apps. Some our VF pages, particularly surveys are URL parameter-driven, since we send survey links directly to users, i.e. https://[...
20
votes
2answers
3k views

Lightning Components in Visualforce - Unable to read sobject

I've started seeing this error since the Spring 16 release when I retrieve an sobject from the Apex controller, update it and then send it back to the server. I originally thought this was down to a $...
19
votes
5answers
14k views

Salesforce lightning get current users username

How I would go about getting the current users username or first and last name? I have been looking at this for the last couple of hours - I was just wondering how I would go about getting their name ...
18
votes
2answers
10k views

Getting Session ID in Lightning

Background I'm using Apex Wrapper Salesforce Metadata API to update some picklist values on the fly. (i.e. Every time a record is inserted/updated/deleted in Table A, I'm adding/subtracting picklist ...
18
votes
1answer
888 views

jQuery DOM manipulation performance in Lightning is awful with LockerService enabled

In a Lightning app that I am building, there is a reasonably large table (has 7 rows for each contact we are dealing with, there can easily be 40+ contacts that we are showing data from). Most of the ...
18
votes
1answer
627 views

What can cause $A.createComponents to be slow?

Simple to ask, possible hard to answer. I have written a Lightning app to create forms which works a bit like the page builder in LEX itself. It saves the form description into JSON, and then ...
17
votes
3answers
1k views

What are the outer parentheses in Lightning controllers?

In every Lightning controller you have these outer parentheses wrapping the actual object: ({ getInput : function(cmp, evt) { var myName = cmp.find("name").get("v.value"); var ...
17
votes
2answers
1k views

Sharing JavaScript between multiple Lightning Components

In a Lightning Component we have the notion of a JavaScript controller and a helper. We can use the helper to call code from the JavaScript controller that is shared between functions, so we can ...
16
votes
1answer
6k views

Forcing a refresh in force:recordData

force:recordPreview had a ignoreExistingAction attribute that would force a server trip. I have an issue right now where I have two components: Comp A - Contains a list of sObjects, saves/updates ...
16
votes
1answer
2k views

Value provided is invalid for action parameter [VAR] of type 'String'" instead

Seems like upcoming changes in Spring 19 are causing us issues with "AuraEnabled" methods. Since forever now, primitive types were sent from Aura to APEX as String only as explained here: https://...
16
votes
1answer
13k views

$A.util.isEmpty() returns true on non-empty proxies

In Lightning, I've got into the habit of using $A.util.isEmpty() instead of testing for null, undefined, and empty Array. That seemed to be a good thing, but I've come across one situation where it ...
16
votes
3answers
667 views

How to access map or object elements dynamically in Lightning?

In VisualForce we could access dynamically to map elements using syntax {!map[mapIndex]} In Lightning if we try to define a map and use this syntax we would receive an error saying Failed to ...
15
votes
4answers
36k views

Getting the URL parameter into Lightning component using the “{! paramName}” expression

I am new to communities in lightning and I am trying to figure out a way to directly fetch the URL parameters into the lightning component attributes using the {! urlParamName} expressions. for ...
15
votes
3answers
1k views

How to send wrapped generic SObjects from Lightning to Apex

I have a lightning component with an apex controller that wraps generic records in an inner class. When I send the wrapped records to apex and receive them as generic SObjects, I get this error ...
14
votes
8answers
22k views

Set width of modal window of lightning action

Do you know how can I set the width of a modal window opened by a lightning component action? In the edit options I can set only the height but is not enough because the content of my table is not ...
14
votes
2answers
5k views

How do I call functions loaded from a Static Resource JavaScript file?

I'd like to put some shared Javascript to Resource file to reuse it between several components. This Javascript is general purpose set of utility functions. However, functions from my resource file ...
14
votes
3answers
17k views

Component events vs Application events (component.getEvent vs $A.get)

I am new to lightning experience and components. I have been through some blogs and code that guide through the basics, but other than that I haven't had much hands-on experience. My question is: ...
14
votes
4answers
2k views

Lightning Framework vs Standard Client Side Frameworks (i.e. React) // Which to chose when, and why?

Disclaimer Keep it objective! This one can get a little opinionated, please try to keep your answer specific to the facts a developer should be considering when choosing between two viable options ...
14
votes
2answers
2k views

Map<String, Object> in AuraEnabled now failing in Spring 19 with “Value provided is invalid for action parameter”

Seems Spring 19 wants stricter typing for aura attributes, but I'm not finding any best practices on how to approach this. This use to work in Winter 19: MainController.js let myData = { parentId:...
14
votes
2answers
576 views

Why would I use lntg:selectSObject?

The Lightning Component Developer Guide reference includes the event lntg:selectSObject. Per the docs, this event: Sends the recordId of an object when it’s selected in the UI. However, the sample ...
14
votes
3answers
2k views

How to get ip address of current user in Lightning component

We are converting our visualforce pages to Lightning component. We were getting the ip address of the current user from visualforce page standard headers. But we cant use the same in Lightning ...
14
votes
0answers
388 views

Continuation Apex Unit Testing - Lightning

With Summer'19 release continuation is available in Lightning. To make long running callouts. Continuation - Aura Dev Guide: https://developer.salesforce.com/docs/atlas.en-us.220.0.lightning.meta/...
14
votes
1answer
373 views

Cannot read property '$$OwnerKey$$' of null

I have a Visualforce Lightning Out page that's rendering some <lightning:input type="date"> elements. Since the Winter '19 release in the dev sandbox I'm working in, whenever I select a date ...
13
votes
2answers
3k views

How to pass query parameters in URL in Salesforce Summer 19 Release?

The requirement was to open a Lightning App page and pass some query parameters in the URL. These query parameters were then used to query data and display in a Lightning component present in the ...
13
votes
1answer
658 views

Create DX scratch org with caching disabled

One of the most useful tips I've come across when developing lightning components in Salesforce is to disable caching, as otherwise Salesforce tends to aggressively cache components which makes ...
13
votes
4answers
8k views

Render fullcalendar on a lightning component

I have a lightning component that pulls data from Salesforce and adds them as events on a calendar created using fullcalendar. The component helper contains the method fetching the data from Server. ...
13
votes
3answers
2k views

Lightning container : index.html not in the right folder

I try to use the lightning container to display an element in a salesforce component. So, I have this code : <aura:component access="global"> <lightning:container aura:id="timeline" ...
13
votes
1answer
883 views

Moment JS format returns function string in Lightning Spring 17

I use momentjs's library in my lightning application to manipulate javascript dates. When my sandbox was updated from winter 17 to spring 17 I noticed the format function doesn't work any more. ...
13
votes
1answer
1k views

component.find({ instancesOf : “lightning:input”}) return empty list in Summer '18

With new Summer '18 release following code returns empty list: component.find("social-security-number-form").find({instancesOf : "lightning:input"}) "social-security-number-form" is an aura:id of ...
13
votes
3answers
2k views

Dynamic Component Creation using “force:inputField”

@SkipSauls wrote an amazing article on how to use FieldSets in Lightning Components. Thank you! Link here But it seems like, using this approach, we can only use OOTB aura components (ui:textbox, ui:...
13
votes
1answer
515 views

ui:inputDateTime date and time pickers not displaying properly

We are working on some Lightning Components for a Salesforce Community. We are using our own template which is bare bones. Here's the code: <aura:component access="global" implements="...
12
votes
4answers
11k views

Winter 17 release : event.getSource is not a function on lightning:button

I'm trying to get the label of the button the user has clicked on by using event.getSource, but I'm getting the error that event.getSource is not a function. Component <lightning:button variant="...
12
votes
3answers
10k views

Lightning component's .focus() not working

I have an input field: <ui:inputText aura:id="name-input"/> With controller code: var input = cmp.find("name-input"); console.log(input); input.focus(); This gives the error: Access ...
12
votes
4answers
7k views

Lightning QuickAction (API) without modal

I am attempting to replace JS buttons with quick actions. These button simply call a web service method and alert the result and need no user interaction. With quick action a modal always seems to ...
12
votes
5answers
5k views

Pre-populate field values in lightning:recordForm onload

I'm using lightning:recordForm to display create view for a custom sObject. It works as expected, but I cannot find a way to pre-populate some of the fields for create view, e.g. lookups. ...
12
votes
1answer
796 views

Examples of use of getValueProvider

I was looking through the AuraDocs reference today and found a function on the Component javascript API that I had not seen before: addValueProvider (String keyObject valueProvider) Adds ...
12
votes
1answer
9k views

Problem with lightning:input component. Onchange event

I am trying to use "lightning:input" components (still in beta) but I encounter an issue when the component is firing the onchange event : Something has gone wrong. Underlying raw object [object ...
12
votes
2answers
2k views

“Limit expression must be of type Integer” error when using Apex variable in SOQL

I'm building a simple Lightning Component that pulls in a set amount of accounts and displays them. However, I keep getting a Limit expression must be of type Integer error message. I've hard-coded a ...
12
votes
1answer
3k views

Lightning : Show Stencil When Component Loads

So I see in the docs for SLDS they talk about using "Stencils" while a page loads. I can't find any examples of how they're implemented. Can anyone point me to any docs or samples that use this?