Questions tagged [lightning-web-components]

This tag is for questions related to JavaScript, CSS, or Markup when used in the Lightning Web Component (LWC) programming model, or for questions of interoperability between LWC and the original Aura-based lightning components.

Filter by
Sorted by
Tagged with
0
votes
0answers
12 views

LWC optional chaining “array?.length' in expression causes output of ”[object Object]"

Context: In my LWC, I have an array that may not be defined, and I want to check its length. So I use the optional chaining arr?.length to not error if the array is undefined. I also want to default ...
0
votes
0answers
19 views

LWC:Getting error while setting Custom Validity Error Messages in LWC form ' [Cannot read property 'setCustomValidity' of undefined]'

I want to check if field is empty before moving to other part of form divided by div. on a button(not submit) have tried custom validation as given in documentation lightning-input-documentation but i'...
0
votes
1answer
19 views

Data table in LWC

Is it possible to achieve this in the data table in LWC? If yes please share some reference. I'm Literally new to Salesforce If I select any rows under any category like colour scheme and if I click ...
0
votes
0answers
23 views

Navigating and passing record Id to LWC on App page from Standard Record page

I want to be able to navigate from a record page say Opportunity to an app page which contains LWC component. I want to pass the opportunity ID to one of the LWC component so that it can work in that ...
0
votes
0answers
11 views

B2B Commerce Lightning

Currently working on B2B Commerce Lightning Store and we have enabled guest view but now the client requires guest cart session. Currently in the B2B Commerce Lightning when we click on the "add ...
0
votes
1answer
24 views

Can I call apex method before wire method in LWC?

I want to perform some check before I get data using wire method. Is there any way to execute apex method and then get data using wire method?
1
vote
0answers
27 views

How to deploy code to SF instance from your branch?

Can I deploy my git branch to salesforce org? Currently, I write my code in vscode and deploy it to org using vscode. If it works, I add that code in the git branch and commit, which gets merged later....
0
votes
1answer
23 views

How do I trigger recordEditForm onSubmit event using Javascript

I am trying to trigger the on submit event on the recordEditForm. I could easily trigger submission itself by using .submit() but that won't trigger the onsubmit JS event handler ( try it, it doesn't ...
0
votes
0answers
16 views

Save Visualforce Page as PDF from LWC component

I have a visualforce page that I can open from a lightning web component with using the following: openPdf1() { this[NavigationMixin.GenerateUrl]({ type: 'standard__webPage', attributes: ...
0
votes
0answers
19 views

How Can I Embed a Dashboard in LWC?

Any ideas to embed a dashboard in lwc? I need it to put inside of another lwc and the given style to put in an experience
6
votes
1answer
43 views

LWC best practices: Getters for derived values vs. setters for controlling values

I'm aware of two separate ways to manage dynamic, derived values in Lightning Web Components, and I'd like to get a better idea of when to use each one. Here is a sample LWC: a repeatable row showing ...
0
votes
0answers
14 views

How to retain checkbox values in lwc pagination when user click on next and previous button [closed]

Suppose we are displaying account records in pagination with a checkbox by using a custom table(not a data table). user has selected 2 records on the first page and 2 records on 2nd page and clicked ...
0
votes
1answer
22 views

Display LWC component as a full width and height page but not via VFP

Is there any way we can display LWC as a separated page similar to VisualForce page? I know we can create an app than aura component which holds LWC component on VFP but we don't want to use VFP at ...
0
votes
1answer
17 views

Open Utilty Bar On the Onload (connectedCallback) functtion LWC Component

I have LWC Component and I need to open the utility page on the connectedCallback of the page: Somewhat like this: https://salesforcecodex.com/salesforce/open-utility-bar-on-lightning-app-load/ ...
0
votes
0answers
15 views

Allow community users to add favorites

Looking to build an LWC that allows for community users to favorite records. Seems like the favorites API isn’t part of LDS. Anyone have any experience with this or know how to hit the favorites API ...
0
votes
1answer
31 views

Error during LWC component constructor phase: [type is not defined]

estoy construyendo un componente web lightning y previamente se había desplegado con normalidad y al agregar unos campos en el JavaScript comenzó a generar este error el componente LWC. import { ...
1
vote
1answer
31 views

LWC Build Files Explaination

I have been trying to research this on my own, but I can't find a simple explanation that tells me the difference between the following 2 files: lwc.config.jsonhttps://developer.salesforce.com/blogs/...
0
votes
1answer
20 views

What's the syntax for hard-coding a boolean value in lightning-input-field tag/component?

I am using a lightning-record-edit-form to update values on an Account record. These values should be hardcoded and are not dynamic. As you see, I have two fields. One is a picklist and the other one ...
1
vote
0answers
17 views

Any ideas on getting the count of users a record is shared to

I'm building a LWC that gives a metric for 'sentiment' but counting the occurrences of used topics in the host record pages feed. It would be nice to be able to have a metric like "75% of Users ...
0
votes
0answers
14 views

How do you to use the lightning-formatted-rich-text LWC component to display Salesforce Base64 Notes (VersionContent)?

Salesforce Note content is stored in ContentVersion.VersionData as Base64. The LWC lightning-formatted-rich-text just displays BLOB(n bytes). The SOQL in Apex looks like this: notesList = [select Id,...
0
votes
2answers
37 views

How to Show/Hide button based on Profile in Salesforce LWC?

I have develop LWC component which is normally used by normal users. In that lightning web component button is there as below. <lightning-button slot="actions" label="Deactivate"...
0
votes
1answer
25 views

Why does a lightning-record-form display in edit mode the first time it's shown, but view mode on subsequent displays?

I have a lightning-record-form in a modal dialog defined as follows: <div role="dialog" tabindex="-1" data-id="editDialog" class='slds-modal'&...
0
votes
1answer
32 views

Why is the “SFDX: Deploy Source to Org” function missing?

I started experimenting with LWC and ran into this problem. What I did in VSC: - Create Project with manifest; - Authorize an Org; - Create Lightning Web Component; - Create Scratch Org and assigned ...
2
votes
1answer
48 views

@track decorated property not updating LWC after imperative call

I can't seem to figure out what I am missing. I have a component that is supposed to display data after it receives an id of the exact record hence I am using an imperative call. I can see in the log ...
0
votes
0answers
7 views

Not able to view images stored as files in IOS salesforce 1 app via LWC

I have a library named "XYZ" in which there are several images that I am showing on my LWC as background as shown below. this.background = 'background-image : url("/sfc/servlet.shepherd/...
-2
votes
1answer
23 views

please help me, how to tie input and button through js in LWC, need to implement a contact filter by contact name

HTML: <template> <div class="slds-m-around_medium"> <div class="slds-m-bottom_small"> <lightning-input type="text&...
0
votes
1answer
20 views

[LWC][CSS]slds-backdrop is not covering full device height behind slds-modal in Salesforce mobile app

We are using slds-modal in our LWC, which is working fine in desktops and large devices. Means behind the modal we are showing the slds-backdrop screen and it covers everything behind the modal box to ...
0
votes
1answer
21 views

CSS Overrides Community Menu

is there a way to make a CSS override for font & fontsize for the lightning community menu. Choosing an custom primary font in the builder doesn't fit, because still the size and spacing is ...
1
vote
1answer
24 views

lightning spinner not covering the full screen in mobile view

I have a simple lightning spinner in LWC <lightning-spinner alternative-text="Loading" size="small" variant="brand"></lightning-spinner> but this doesn't ...
0
votes
1answer
34 views

LWC, handle event null

I have a Parent component which is a data table and a child component that is a combobox For each record in the data table if the user click on an Edit button, then the combobox appear and give the ...
0
votes
1answer
29 views

LWC Combobox:onchange event

I want to prevent updating the combobox values based on some condition when user select any value. Here onChangeHandler is the method that does the validation and if it gets failed the picklist values ...
0
votes
0answers
17 views

Lookup field not working in custom URL

A form is created to enter the record of the assets. Everything is alright when filling the form with my own account. However, the lookup function of Accounts and Contacts is not working when entering ...
1
vote
1answer
30 views

Need help with LWC and iframe

I appreciate you looking. Here's the problem I'm having: I have a project that includes pdfjs as a static resource. Part of this resource is an html file, viewer.html, that is the actual pdf viewer....
1
vote
0answers
37 views

Unable to build Lightning Component source for markup://c:HelloWorldLightningWebComponent: Invalid suffix: json

I have created a project named "HelloWorldLightningWebComponent", and created a LWC component to it. While deploying the source to org from VSC, getting the error message. I have checked the ...
2
votes
1answer
50 views

LWC latest ESXX features not working in modules

I have a LWC that, for other some users, it is not behaving as expected, and the following code: _setActionsColumn() { if (this.actions && this.actions.length > 0) { ...
0
votes
1answer
37 views

How to update multiple fields with one click in LWC?

I am tasked with creating an LWC that will update five fields on the Account object. The LWC only needs to contain one simple button with a heading. The button needs to be displayed only if certain ...
1
vote
1answer
25 views

LWC Datatable - Multi-level Headers

Is it possible to format multi-tiered headers with LWC lightning-datatable component? I do not see anything in documentation, and I've tried passing in nested array of headers into columns attribute. ...
1
vote
2answers
59 views

LWC Get record field values and render DOM elements conditionally

I want to create a custom component for a record page that gets a field value for the record, determines if the value is null or not. If it is null, some content will be shown and some will be hidden. ...
2
votes
1answer
32 views

Updating the Data for an LWC lightning-datatable isn't re-rendering the lightning-datatable

I'm running into an issue getting a lightning-datatable to rerender when I update the data attribute. My LWC contains 3 buttons for testing and a lightning-datatable that is connected to the ...
0
votes
0answers
21 views

Platform Events and LWC Refresh

I have the following flow, LWC -> Apex (REST API) -> Inserts data in some_object__c -> Trying to refresh the LWC which is based on the some_object__c. I have a platform event(PE) which fires ...
0
votes
1answer
59 views

please tell me what I'm doing wrong: you need to implement a contact filter by contact name [closed]

js: import { LightningElement, track, wire } from 'lwc'; import getContactList from '@salesforce/apex/ContactController.getContactList'; import {ShowToastEvent} from 'lightning/platformShowToastEvent';...
0
votes
1answer
31 views

how to get HTML content with HTML tags from LWC tags

Is it possible to get HTML with tags from the lwc components? Can I get something like (in my JS) <table> <tr> <th>SomeHeading</th> </tr> <tr> <td&...
0
votes
0answers
30 views

Apex: How to automate page layout assignments using Apex [closed]

I would need help in automating page layout assignment using Apex. Please help guys :)
2
votes
1answer
41 views

Is there an option to add an “Are you sure you want to leave?” popup before a User navigates away from an LWC?

I'm working on a community where I need to show a popup if a user navigates away from their shopping cart and there are items in it. I have this built in a Lightning Web Component. I can get the pop-...
1
vote
0answers
10 views

Getting available time slots in Lightning Scheduler

When creating a Service Appointment in Lightning Scheduler there is no standard validation to prevent from booking a Service Resource multiple times during the same time slot. How can we get available ...
0
votes
0answers
26 views

Thumbnail Image in lightning Datatable lwc

I need to display files thumbnail images in my data table in LWC. I have followed this blog, but in my component, I'm getting the URL instead of images. Below is my code: thumbNailImage.html: <...
1
vote
1answer
38 views

LWC variable not defined

I am creating a LWC data table and I would like that when the user click on "Edit Table" The fields in the table will get the inline edit true import { LightningElement, wire, api } from '...
0
votes
1answer
28 views

Text doesn't wrap in <div> and <lightning-card>

I have a little problem, text inside tags doesn't wrap (I don't use <p> and write text in <div>). HTML is very simple, but I can't solve the problem: <template> <div class=&...
0
votes
1answer
17 views

Iframe Id null in iframe onload method

I am loading iframe dynamically on button click of the window, the iframe uses pdfJs library. However, in onload method of the iframe, I am geting iframe object as null, and getting error. This is my ...
1
vote
0answers
29 views

How to JEST test a lightning-input of type “file”

I have an LWC that updloads a file: <lightning-input type="file" label={label.AttachInvoice} accept="image/png, image/jpg, image/gif, application/pdf" onchange={...

1
2 3 4 5
93