New answers tagged lightning-web-components
0
votes
0
votes
Custom LWC Flow Screen Component - use Picklist/Record Choice Set as input
I'm having the same issue. I made the property as an array of strings (String[]) but it didn't help. Have you found a workaround?
0
votes
recordId is undefined in LWC quick action component
This can be confusing as normally the connectedCallback() guarantees that the recordId is populated. But it is not the case for the lwc quick actions.
Explanation from similar question: https://...
0
votes
line break in lwc
I had the same issue and I've resolved it with putting '\n' in my text and also setting lightning-formatted-text tag that will show my text.
Here is example how I've achieved it:
In JS:
let errMsg = '...
0
votes
LWC: How to track wired properties' LDS activity
adding this as an FYI as this is an old question without any responses.. this is what I've done in the past to get around this issue as I've also had the same sort of problems arise.
I have added a ...
0
votes
LWC Component with Different Context based on Record Page v Home Page
You can use a getter/setter to insert a null value:
_recordId;
@api set recordId(value) {
this._recordId = value || null;
}
get recordId() {
return this._recordId;
}
_recordId is just a notation ...
0
votes
Multi column sorting in lightning web components
Suppose you have an Array of Users with properties firstName and lastName.
let userArray = [
{
firstName: "Andrew",
lastName: "Hall"
},
{
firstName: "Karan&...
2
votes
Accepted
Hide/Show columns of lightning-datatable in Lightning Web Components
The only thing you need to do is removing the desired element from the columns array, or use the original set if you want it back.
<template>
<lightning-input type="toggle"
...
0
votes
Getting tasks stored in List Views
The User Interface API is what you need. This is a link to the operations specifically dealing with List Views, including fetching records:
https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/...
0
votes
Apex Method Imperative calling in LWC
Have you made sure to import the Apex method you are calling?
import apexMethodName from '@salesforce/apex/Namespace.Classname.apexMethodReference';
We cannot see all of your Javascript given what ...
0
votes
How can I add top border in lightning-tab
As possible variant :
You can create local css file and then upload it to your lwc as static resource
the css file will look like this :
.slds-tabs_default__item {
border-top: 1px solid black;
}
...
0
votes
Assert Violation: c() 2nd argument Ctor must be a function
This happens when an unsupported component is encountered. The error is complaining about lightning-input-field, which is not part of the npm lightning-base-components. You can see the full list of ...
2
votes
How to use Cobertura and JUnit reporters with LWC Jest?
I found out via the official Jest documentation that you can also overwrite or extend the configuration (Configuring Jest).
If you do this as follows, you can also use Cobertura, JUnit or even other ...
1
vote
Update Record field through LWC button click
You don't need both:
@wire(getCheckedStatus)acStatus;
and
getCheckedStatus({selectedAccId: this.recordId})
Choose one.
Also,
const allValid = [...this.template.querySelectorAll('lightning-input')]
...
0
votes
Enable Lightning Components "debug mode" for a guest user
You can set the UserPreferencesUserDebugModePref field on the Guest User to enable lightning component debug mode, e.g.
$ force record update user 005... UserPreferencesUserDebugModePref:true
0
votes
Accepted
LWC Set Interval function not working when used inside a wire function
// If the count down is finished, reset to Zero
let day = new Date(this.deadline);
let ddate = day.getTime();
console.log(">>>ddate getTime() " + ddate); //getTime() ...
0
votes
What's equivalent of availableForFlowActions in LWC
You can use lightning__FlowScreen, as described in Create Flow Screen Components. From there, you can use lightning-flow-support to interact with the Flow runtime.
1
vote
How to and retrieve , display the key and value of map<string,id> in LWC which is returning from an apex wrapper class
Use below logic in LWC JS file:
getPageResoursesFalse()
{
pageResourcesFalse({cardName:this.tile})
.then((result)=>{
let resultData = [...result];
resultData.forEach((...
0
votes
Cannot use 'import' in LWC JS
You are trying to import LWC library inside AURA. If You wanna create lwc component then you cant directly do in org, you need some code editor try to use VS code Editor for Lwc component.
0
votes
How to use SLDS responsive sizes when an LWC is in a multi-column page?
AFAIK this related mechanism Make a Component Width-Aware is the only mechanism available:
@api flexipageRegionWidth;
It reports the flexi-page "region’s width" as:
SMALL
MEDIUM
LARGE
and ...
0
votes
How to overflow LWC component inside flow
Make sure you are not overwriting the overflow or overflow-y property in your css file. Also, make sure if slds-scrollable class is used anywhere as it also overwrites the overflow property.
You can ...
0
votes
How do I display multiple badge-count in lightning-vertical-navigation?
I made it this way:
<li class="slds-nav-vertical__item" key={tab.Id} onclick={handleMonthClick} data-index={index}>
<a href="#" class="slds-nav-...
0
votes
Is it possible to achieve this in lightning data table in LWC
I’m using custom data types and one wrapper class to fetch the records. But still it’s showing each records one by one in rows.
0
votes
Accepted
Want to increase lwc icon size in in specific pixels. so what i did is added style="size:50px" this is not worked for me
Generally, you'd use the size attribute but if you want it bigger or smaller then using the zoom CSS property is your next best option
<lightning-icon icon-name="utility:travel_and_places&...
0
votes
Is it possible to achieve this in lightning data table in LWC
You can do this by building custom Data Table and using rowspan.
https://www.lightningdesignsystem.com/components/data-tables/
1
vote
LWC Quick Action Error with Record EDIT Form for Lookup Field after Summer 22 Update
We have an ongoing investigation for this behavior numbered #W-11115198 logged with the concerned salesforce product team. It was reported by several other customers too and is being worked on with ...
2
votes
How to get selected rows from multiple tables with one button in LWC?
JavaScript has a number of ways to do this. Here's one example:
let eachTableSelections = [...this.template.querySelector('lightning-datatable')]
.map(table => table.getSelectedRows());
let ...
0
votes
Error with Events lwc - [NoErrorObjectAvailable] Script error
getRecordNotifyChange({recordId : this.currentRecordId});
this syntax will also give the above error,
below is correct one
getRecordNotifyChange([{recordId : this.currentRecordId}]);
4
votes
Accepted
TypeError: Cannot read properties of undefined (reading 'DOB') in for loop
When initializing your for loop to iterate through an array using its length and starting at 0 you need to use < rather than <=.
In your code you have:
for(let i=0 ; i <= this....
1
vote
Can we insert an image in lwc cmp without using static resource?
Yes, there are a few mechanisms. One common mechanism is using Asset Files (ContentAsset), which is stored like a File (ContentDocument/ContentVersion), but is deployable/packageable. Here is an ...
0
votes
How to sort records on javascript based on a nearest due date
Please use below logic:
let dateArray = [
'2022-12-30',
'2022-04-01',
'2022-05-30',
'2022-07-30',
'2022-06-30'
];
dateArray.sort((a, b) => {
return Math.abs(new Date() ...
0
votes
Accepted
Date format in lightning-input after changed input value format
Value attribute should be in YYYY-MM-DD format. On view based on locale you can see same date in different formats.
Update js code as below.
this._DOBLife1 = '30/04/1964';
const dobparts = this....
0
votes
How to trigger a click() event on LWC element
Just a heads up, as of 2022 lightning-base-components (lighting-button) is passing the click event to the button.
Should just be able to call this.template.querySelector('lightning-button').click();
...
0
votes
key={uniqueId} directive now working with template tag
This was likely a bug if it was previously supported. Every top-level element inside a template iterator must have a unique key.
<template for:each={items} for:item="item">
<div ...
0
votes
Conditionnaly wire data in LWC components based on context
You can separate these two functionalities into two different components instead of fetching data based on conditions from the connected callback:
Fetching data from the wired method.
Processing and ...
0
votes
Accepted
LWC NavigationMixin Not working
For NavigationMixin we need to follow this format in the .js:
export default class IDS_SendSuveryfooter extends NavigationMixin(LightningElement) {
......
}
Follow the documentation for more ...
0
votes
how to put html body on mailto href with lwc?
Unfortunately, you can't. RFC 2368 states:
The special hname "body" indicates that the associated hvalue is the
body of the message. The "body" hname should contain the content ...
2
votes
Accepted
getter vs setter in LWC
tl;dr Avoid changing data in a getter.
A getter can technically do everything a setter can do. However, performing transformations in the getter are generally a bad idea from a programming perspective ...
1
vote
Accepted
How can we define the events method in util.js or exernal js file and export that method in lwc component
For common methods that should be used in multiple places, you have three basic choices.
First, you can export the method, and then call it from your component.
let test1 = false
function handleClick(...
1
vote
How can we define the events method in util.js or exernal js file and export that method in lwc component
Create LWC of name utils.
Use utils.js as below:
export function externalFunction(event){
//function logic
//return data as per logic
}
In LWC component js file import the function to use it:
...
1
vote
getter vs setter in LWC
Getter and Setter - these are nice to have in your code but not must-have. In reality, there are many cases where programmers don't even use getter setter in the code. However in short and as per ...
1
vote
getter vs setter in LWC
Technically we can use getter and setter interchangeability and it may work but its bad for performance, it's better to do any computing in setter.
In below example, getter is called whenever the ...
1
vote
getter vs setter in LWC
You can set a property in a getter as well but it is not advisable.
The get syntax binds an object property to a function that will be called when that property is looked up. Sometimes it is desirable ...
0
votes
Hiding LWC datatable Header
I don't think you have any standard tag to hide the column headers as they are used to map your data items in the order. You'll probably need to go for custom CSS to hide the column headers.
EDITED :
...
0
votes
Hiding LWC datatable Header
Update :
length of result variable could be zero hence check length of result for assigning value to showPPGRecords
//End Code
connectedCallback() {
this.currenRecordId = this.recordId;
...
0
votes
Accepted
Getting error for user fields in LWC component when using schema?
This is a known issue with the LWC Deployment with the tooling API of Salesforce. If the underlying tool in your case the chrome extension uses tooling API for LWC Bundle deployment causing the issue.
...
1
vote
Accepted
lightning-input-rich-text deleting rendered email template on backspace
Per Salesforce, editing HTML email templates in the lightning-input-rich-text tag is a know limitation and cannot be done.
0
votes
Http POST/PUT data via LWC or VF
If you are developing new and if your users are using Lightning UI, I would suggest you focus on LWC instead of VF page.
With that said, you can achieve this both in LWC and VF. Approach for Lwc is as ...
2
votes
Accepted
Cannot update list in JS after assigning value to field in that list
You need to modify the original variable. As you've probably noticed, however, the data is read only. tempVar is disconnected from the original data because you used JSON.parse(JSON.stringify(...
2
votes
Adding LWC in Record Page Layout Section
I believe it makes sense to consider adoption of Dynamic Forms (current standard object limitations may prevent it, of course).
It is worth considering that Salesforce's long term goal, as has been ...
Top 50 recent answers are included
Related Tags
lightning-web-components × 6441javascript × 944
lightning × 756
apex × 711
lightning-aura-components × 463
lightning-datatable × 323
lwc-wire-adapter × 303
html × 257
css × 246
community × 201
salesforcedx × 197
lightning-experience × 187
lwc-dom × 161
lightning-design-system × 147
aura × 146
slds × 136
visualforce × 134
lwc-jest × 125
visual-workflow × 99
lightning-recordeditform × 89
wire × 77
datatable × 76
js × 75
lightning-events × 71
navigationmixin.navigate × 67