For questions about Lightning Web Components (LWC) - the UI framework for the Salesforce platform. When using this tag also include the more generic [salesforce] tag.
Questions tagged [lwc]
503 questions
1
vote
1 answer
How to access loaded script in Salesforce Lightning Web Component?
When loading an external library in a Lightning Web Component, I can't seem to access the actual script.
Instead, I can only find the reference to the static resource by checking the resolved import string.
phone.js:
import { LightningElement } from…

Melvin Kusters
- 13
- 1
- 3
1
vote
1 answer
I'm doing the LWC Superbadge Step 6. Unable to retrieve metadata for descriptor is the error I keep getting
import {LightningElement, api} from 'lwc';
const TILE_WRAPPER_SELECTED_CLASS = 'tile-wrapper selected';
const TILE_WRAPPER_UNSELECTED_CLASS = 'tile-wrapper';
export default class BoatTile extends LightningElement {
@api boat;
@api…

FSGeoff
- 11
- 2
1
vote
0 answers
How to get account Id from js? lwc
Need to get in tile.js account info that available in tile.html
Got 4 different components: selector, list(nesting selector), details(nesting selector), tile(nesting list). From apex controller passing query of accounts to list, and then 1 account…

Meatinboots
- 31
- 1
- 3
1
vote
2 answers
ChartJs 3.x: ResizeObserver is not a constructor
I'm trying to use ChartJs in LWC, I took the last 3.3.2 version and followed several examples in order to create my chart (here one of the most complete example I found), but when invoking the instruction:
this.chart = new window.Chart(ctx,…

zeldez
- 11
- 1
- 2
1
vote
2 answers
Salesforce, Lightning Web Components - change code online
Is it possible to change code (html, js, css) in Lightning Web Components online in Salesforce?
Something like this
I don't know to run it according this manual.
Because I would like to check code imported from VSCode. It seems to me that the…

Elo
- 226
- 5
- 19
1
vote
1 answer
Template.QuerySelector inside Template Tag Not Working
I am trying to render a jsonTree instead of just json text and have the following javascript code to do it (Note: It is in a switch statement):
case 'LONGTEXT':
this.isLongText = true;
var wrapper =…

Alex88
- 51
- 1
- 6
1
vote
1 answer
How to remove empty object in array?
I am trying to remove the empty object {} from the below structure.
data = [{
"total" : "value",
"status" : "statusVal",
"recs" : [{
"total" : "value",
"region" : "name",
…

ləːnə
- 323
- 2
- 8
- 22
1
vote
2 answers
401 Unauthorized REST API in lightning web component salesforce
I'm trying to execute query using REST API, in a lightning web component.
the request in Postman returning result with success (enabling Follow Authorization header)
but in the JavaScript in lightning web component it returns 401 Unauthorized
the…

Oubayda Samrouth
- 29
- 5
1
vote
4 answers
Change Object field value from array in LWC
I can't update object field value in array in this part.
this.wiredProducts[0].Price__c = this.selectedRate;
I can get this value but can't do anything with it. It throws such error:
[NoErrorObjectAvailable] Script error.
So may be someone knows…

python_newbie
- 23
- 1
- 7
1
vote
1 answer
Static Resource not loading in LWC but loading in Aura Successfully why?
Static Resource not loading in LWC
I have static resource which is loading successfully in Aura Component and Visualforce page but not in the LWC
Folder Structure
Staticresource>Cal>fullcalendar.min.js
cal -> folder name
fullcalendar.min.js ->…

Isthiyaq salesforce
- 11
- 2
1
vote
1 answer
not able to add new key value pair in the JSON object kindly some one help me out
I am trying to add key value pair in the below JSON object, but it is getting added in the wrong way, is there any way i can add to each object a new key value pair, that will help me to complete the req.
JSON as follow :
var object =[
{
…

Ashmita ranjan
- 21
- 1
- 8
1
vote
1 answer
webworkers not working in salesforce LWC js
I have written basic code in lwc js and it's not working any help would be appreciated.
here's my code -
////main js.
var worker = new Worker("/resource/webWorker");
worker.onmessage = function(e) {
alert('Message received from…

SalesforceDeveloper
- 11
- 1
1
vote
0 answers
Salesforce LWC FullCalendar V5 Initialization Issue
Having an issue with initializing V5.3.2 FullCalendar in Salesforce Lightning Web Component:
JS:
import { loadStyle, loadScript } from 'lightning/platformResourceLoader';
import fullCalendar from '@salesforce/resourceUrl/fullCalendar532';
// import…

Dima
- 21
- 1
- 4
1
vote
2 answers
custom carousel in LWC
How do i create an LWC carausel design where the text and image are shown side by side instead of the default top and bottom.
what i want is to make 1 & 2 side by side not top and bottom.
link from where i took the default…

Gaurav Kumar Pandey
- 33
- 3
1
vote
1 answer
Module not found: Error: Can't resolve 'lightning/platformResourceLoader'
I have created a LWC (Lightening Web Component)by referring below documentation.
https://trailhead.salesforce.com/en/content/learn/projects/build-your-first-app-with-lightning-web-components-open-source/create-the-application
And, I expect to use…

user3860630
- 169
- 1
- 6