56
votes
Accepted
What is suggested approach to transfer VF pages to be lightning ready
WINTER-18 Update
new property for VF <apex:page> tag lightningStyleSheets="[false|true]" will supposedly be the single thing you need to do to convert VF pages to SLDS type styles
https://...
50
votes
Accepted
Infinite Loop Caused by Controller Action in Lightning Component
I found the solution. DO NOT GIVE YOUR JAVASCRIPT METHOD AND YOUR APEX CONTROLLER METHOD THE SAME NAME. When I defined the saveAction:
var saveAction = component.get("c.saveAccount");
the ...
49
votes
Accepted
What are the available $A JavaScript functions in Lightning?
Answering my own question. The Lightning Components Developer's Guide has the following:
The Aura object is the top-level object in the JavaScript framework
code. For all the methods available ...
36
votes
Accepted
Use of setCallBack() in Lightning
Basically, the setCallback() function sets a function to run after the action finishes. You might be wondering why we can't just call getReturnValue() on the action right after enqueuing it and why ...
35
votes
Accepted
Getting Session ID in Lightning
So, as it turns outs there is no way of getting a valid API-capable Session Id from lightning component, here is a quote from the partner discussion forums:
Three things:
There's no $Api global ...
32
votes
Accepted
Lightning App - getting URL parameter
In lightning whatever attribute you define can be passed as a query parameter .
Lets take a look with sample example
<aura:application>
<aura:attribute name="whom" type="String" default="...
32
votes
Accepted
Lightning Experience: How to prevent the display of obsolete data?
Actually, this problem is due to the "aggressive" caching setting in LEX. Go to Setup Home > Security > Session Settings. Uncheck the option: Enable secure and persistent browser caching to improve ...
31
votes
Accepted
How to pass query parameters in URL in Salesforce Summer 19 Release?
I think there is a Critical Update that gets auto-enabled for Summer '19, that forces Lightning URL parameters to be namespaced. And the default namespace for orgs is "c".
So if you add ?foo=bar to ...
30
votes
Accepted
How to use custom LWC lightning component in lightning-datatable
Step 1 : create custom component as follows.
pocCustomComp.html :
<template>
<div>
Id: {recordId}
</div>
<lightning-file-upload label="Upload"
...
29
votes
Accepted
Lightning : Icon color is not changing using the fill CSS
Actually the issue is which element you are applying the "fill" property to. Meaning when you declare something like <lightning:icon class="icn" iconName="utility:favorite&...
28
votes
Getting the URL parameter into Lightning component using the "{! paramName}" expression
After Summer 18 release (API version 43 and up) we can do this.
Implement lightning:isUrlAddressable interface and use pageReference attribute.
Example. - Component
Assume url is https://<...
27
votes
Accepted
When to use {#v.attrib} vs {!v.attrib}?
If you want to show a value dynamically based on a aura:attribute, generally we tend to use: {!v.attrib}
Eg: <ui:button label="{!v.attrib}" />
So if you do cmp.set('v.attrib','test'), then ...
27
votes
Accepted
How to navigate in lightning out?
I ran into the same issue. I have Lightning Components I want to use in VF pages AND in Lightning apps running in the Lightning Experience. I also didn't want to update the components to check to see ...
27
votes
Set width of modal window of lightning action
There seems to be some confusion around this question. The question asks specifically how to increase modal width when the modal is opened by a lightning action button.
Some answers will work when ...
25
votes
Accepted
Component events vs Application events (component.getEvent vs $A.get)
Component events: to talk to a parent using the capture and bubbling mechanism, like with DOM events. Usually, one component is interested by the event, like an event aggregator.
Application events: ...
24
votes
Accepted
Chain wire methods together in Lightning Web Components
You have to use dynamic binding:
@wire(getPicklistValues, {recordTypeId: "$rtId", fieldApiName: TYPE_FIELD})
picklistValues;
This is mentioned in Use the Wire Service to Get Data.
I wrote a ...
23
votes
Accepted
Forcing a refresh in force:recordData
ok - reloadRecord takes 2 undocumented arguments
reloadRecord(skipCache, callback)
so you can just do a
cmp.find('recordData').reloadRecord(true)
on init, or whenever you need.
21
votes
Accepted
Lightning Components in Visualforce - Unable to read sobject
So after quite a bit more investigation, the workaround for this is to set an sobjectType attribute on the sobject prior to sending it to the server. Thus if I update my sendToServer method as follows:...
21
votes
Accepted
Reset an Aura attribute to a blank sObject type?
Add the following piece of code at the bottom of your controller:
component.set("v.newItem",{'sobjectType':'Camping_Item__c',
'Name': '',
'Quantity__c': 0,
...
21
votes
Accepted
How do I call functions loaded from a Static Resource JavaScript file?
you could attach your utility methods to the global window object(SecureWindow) and use it in your controller.
Static Resource: TestScript
(function(w){
"use strict"; //Optional because LC on ...
21
votes
Accepted
Storable Action - System.LimitException: Too many DML statements: 1
Simply remove the (cacheable=true) parameter from your @AuraEnabled annotation. Caching a delete operation does not make any sense, and is not allowed.
If you read Lightning Components Best Practices:...
20
votes
Accepted
Getting sObject Type into lightning component
You can implement force:hasSObjectName interface in your lightning component and you can get the name of the sObject type.
<aura:component implements="force:hasSObjectName">
<aura:...
20
votes
Accepted
Parent Field in Lightning Datatable
Doing the "flattening" as mentioned in Winter 18 <lightning:datatable> does not get values from a parent record can be simple if everything is hard coded:
if (state === "SUCCESS") {
...
20
votes
Bell notifications via apex
From Winter 2021 you will be able to send notifications directly using apex. The below code works with winter 2021 and later.
Id typeId = [SELECT Id FROM CUstomNotificationType WHERE DeveloperName = '...
19
votes
Winter 17 release : event.getSource is not a function on lightning:button
event.getSource() is a proprietary API only available on Aura Events, so, no, you can't use that with lightning:button, just like all components from the lightning namespace, they will not rely on the ...
19
votes
Accepted
Need to preview a Lightning Component
Having a dummy app for the purpose of previewing is typically what I do. You don't need Lightning Out for this, though. Just put the component directly in the app:
<aura:application extends="force:...
19
votes
Accepted
What are the outer parentheses in Lightning controllers?
This choice was made for two reasons.
We parse the Controller and Helper on the server to validate them. There are many different Java Parsers of JSON we could use, but regardless which we choose we ...
19
votes
Accepted
Dynamically create a lightning component and put it into a custom lightning component
A Lightning attribute like v.body, which is typed as Aura.Component[], is called a facet. It's perfectly legal to have multiple facets in your component.
You'd have to do something more like this, if ...
18
votes
Accepted
Salesforce lightning get current users username
I wish there was concept like merge field in Lightning components where some functions were global and directly accessible but looks like only way to do this will be code with server side call.
Below ...
18
votes
Accepted
AuraClientService.postProcess: error in processing [RangeError: Maximum call stack size exceeded] - Client Side Action
As per the doc, it is recommended to use different names for the client side and server side methods/actions.
Use unique names for client-side and server-side actions in a
component. A JavaScript ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
lightning × 6445lightning-aura-components × 2985
lightning-experience × 873
lightning-web-components × 782
apex × 643
javascript × 533
visualforce × 431
lightning-design-system × 395
lightning-apps × 370
aura × 337
community × 289
css × 148
slds × 118
locker-service × 116
visual-workflow × 112
lightning-datatable × 107
lightning-community × 105
salesforce1-app × 95
javascript-controller × 91
lightning-events × 89
controller × 83
quickaction × 75
salesforcedx × 73
custom-button × 71
page-layout × 68