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
1answer
490 views

How to change Time zone Name from UTC to Uhr in <lightning-formatted-date-time>

formatted-date-time tag in lwc with Time zone UTC. and out put is coming like 'Montag, 25. November 19, 09:00 UTC', now i want to change UTC to Uhr(German time zone). Is it possible to change time ...
0
votes
0answers
161 views

Lightning Datatable sorting arrow toggle the opposite to the sorting direction

To put it short, my url column is working fine with the sorting function from the sever side. But the arrow next to the column header would point to the opposite direction of the sort. For example : ...
0
votes
1answer
25 views

Display empty field in lwc datatable if user not entered value. Empty field should not effect other fields displaying in table [duplicate]

MMID AND STOCKING ID are fields which are optional. If these fields are empty it effecting other fields to display. Entire table not displaying. Because its checking the values. @wire(...
0
votes
1answer
32 views

LWC Map component - how to hide the location in listview?

am using lat/lon to display locations on a lwc lightning-map component. As a result of using lat/lon coordinates to define the pins, the list view is showing the lat/lon coordinates underneath the ...
16
votes
2answers
17k views

How to target LWC by name attribute?

During a submit I'd like to intercept the event and run some custom validation on the input values. Here is a simplified template of what I'd like to do: <template> <lightning-input type="...
5
votes
1answer
181 views

Is it possible to deprecate and subsequently remove a public attribute of a Lightning Web Component in a managed package?

For example, with this following snippet, if I wanted to remove the property from the package, what would be possible to do? <targetConfigs> <targetConfig targets=“lightning__RecordPage”&...
6
votes
2answers
905 views

How to dynamically import a module in lwc

I am trying to import modules dynamically in my LWC component. While pushing the change I get a strange error LWC1509: This experimental syntax requires enabling the parser plugin: 'dynamicImport' ...
0
votes
1answer
54 views

How to pass parameters for Lightning web component called from VF page

I have a lightning component which is included inside a VisualForce page. When accessing the page directly with a url parameter 'Id' this works fine (component loads inside the vf page and display ...
1
vote
1answer
41 views

I have this error from My Lightning Message Channel in LWC. What can cause this?

I have this error from My Platform Events (via lightning/empApi) in LWC. I get this when i use the "onError" method from 'lightning/empApi'. What can cause this ? Any help will be ...
1
vote
5answers
1k views

Cannot read property 'split' of undefined - in LWC js

I have the following LWC, when I try to add on my lightning record page got some error like, cannot read property of split. js: import { LightningElement, api, track } from 'lwc'; export default ...
0
votes
1answer
42 views

LWC lightning-formatted-number

I suspect a bug in the lightning-formatted-number Lightning Web Component. Can anyone confirm, or have I misunderstood? I have this in a LWC: <lightning-formatted-number value="123.456" ...
1
vote
0answers
44 views

Create html page (admin friendly)

We want to display the Salesforce record as a PDF which it's had a table and image. The admin able to construct the table, header logo and apply styles. This is our use case. What we are thinking, use ...
0
votes
1answer
32 views

Trying to do numerical operations using LWC component but getting NaN as response in the output

I'm trying to create a calculator component and it is working, the problem is the numbers are not properly parsed and I'm getting NaN as the response. Here is the sample output I'm getting : Result ...
0
votes
0answers
31 views

Need to update Lightning Record form with the latest value when record is updated [duplicate]

I have a scenario where I have two LWC. 1st LWC is making a callout and updating salesforce record from callout response. 2nd LWC is using the same record to show fields on UI using Lightning-record-...
0
votes
1answer
1k views

LWC: Form Data not updating to Apex controller

Ive developed a component that lists Contacts related to an Account. Each Contact listed has an action button that opens a modal window to edit fields on the Contact. If I change the value in one of ...
1
vote
2answers
102 views

LWC event.currentTarget.value is undefined in production but works in sandbox

I have the below code for creating a list of checkbox's to select multiple options to filter a datatable. The code works fine within the sandbox however once i moved the code to the production org the ...
0
votes
1answer
56 views

wrapper class in LWC

I am calling an apex method from lwc which returns a wrapper class like below. public class LoadDataWrapper{ Account acc; List<Opportunity> opps; List<Product2> prods; } Is ...
1
vote
2answers
1k views

getFieldValue not working properly in LWC

I am trying to retrieve the field value once a record is created and submit button is pressed. So I am getting the record Id via event.detail.id in my js but I tried retrieving the value with the Id ...
0
votes
1answer
2k views

Radio button needs to be clicked twice to get cheched

Below is my code I have 2 radio buttons, one of the radio buttons is checked by default using the "checked" attribute. I want to show different content when each of the radio buttons are ...
0
votes
1answer
2k views

Error: Cannot find module '@salesforce/sfdx-lwc-jest/config' while testing my LWC from vs code

I have started my practice on LWC testing While i'm run this command:"npm run test:unit" i am getting this error:Cannot find module '@salesforce/sfdx-lwc-jest/config'. Error body is: Error: Cannot ...
0
votes
1answer
2k views

LWC:"ReferenceError: a is not defined at eval (eval at productFamilyOptions

getSettings method below returns settings JSON record and when i am trying to set picklist options using productFamilyOptions variable which is used as options of the .html file, I am getting this ...
3
votes
2answers
125 views

How to pass URL parameters to a Lightning App page, to load LWC in context of a record?

I want to make a standalone salesforce page that loads data specific to a current member. I tried making an App page, however when I load /lightning/n/MyAppPage?recordId=something it redirects to /...
5
votes
3answers
7k views

Flatten data to display it using lightning datatable in LWC

My wrapper class returns sObjects of type account and contact along with other fields, to my LWC. I am not able to display the data using lightning datatable as something like fieldName:'AccountId....
0
votes
1answer
686 views

recordId is empty when overriding edit button in lwc?

I needed a custom popup for creating and editing a record. To achieve this I have created a LWC which will create and edit the record. I had wrapped this component with an aura component. and ...
0
votes
1answer
48 views

Display related fields in LWC Datatable [duplicate]

Trying to display related fields from junction object linked to 2 objects vis Master Detail : @track columns = [{ fieldName: 'related_field__r.Name', label: 'Name', type: "text", ...
0
votes
1answer
512 views

How to Include Global Styles in LWC System

I'm working on a customer service system using Salesforce Lightning and the Lightning Web Component (LWC) framework. What's the best way (if any) to include a global stylesheet to create/override ...
0
votes
2answers
494 views

dataLayer in Lightning component

Can someone tell me how can I access DOM dataLayer in lightning component controller? I'm using like this but its not pushing into DOM dataLayer window.dataLayer = window.dataLayer || []; ...
2
votes
2answers
143 views

force refresh (f5) of a page after LWC quick action

edit: resolved see code. I have a quick action which updates data on the detail page, after hitting said button the page needs a full refresh. Scenario on the account page the user clicks the quick ...
3
votes
1answer
1k views

Lightning Web Component displaying cached source from previous deploy

During development of Lightning Web Components I have seen on multiple occasions an issue where the compiled source in the browser does not match the source deployed to the org, but instead matches an ...
0
votes
1answer
24 views

How can I get my search field to align with the other grid items

I have a header component with a sub-component search field. <template> <div class="header-grid"> <div> New Opportunitites </div> ...
2
votes
1answer
19 views

Reload child chartJS component onchange of slider value from parent component in LWC

It is working after I refresh the entire page but I need the child component to reload. Parent Component : <template if:true={chartConfigurationSubjective}> <c-acc-child-...
1
vote
1answer
37 views

Why isn't lightning-combobox actually setting the value to the selection?

I have a combobox in a modal dialog that looks like this: <template if:true={showAddTagDialog}> <section role="dialog" tabindex="-1" ...
0
votes
1answer
51 views

What are the risks of using LMS on an Experience Cloud Site, and is it on the Roadmap to be GA?

Currently I have a few components that use the Lightning Message Service, but I realize that this feature is in beta for Experience Builder sites. As of right now, my components seem to work as ...
0
votes
1answer
52 views

Date formatting issue in LDS lightning-record-edit-form

We have built LDS forms using lightning-record-edit-form, lightning-input-field tag is used for date which displays standard locale date format as per documentation. The problem is, it is always ...
0
votes
1answer
2k views

How do I get lwc record-edit-form onsubmit to refresh the entire component?

I have a component with 1) a datatable of Metric__c records, and 2) a record-edit-form to add a new metric record. The Submit button on the form successfully creates the new record, but because the ...
1
vote
1answer
164 views

how to show data of child object records of parent record using lightning-datatable in LWC [closed]

I have this requirement to get all child records only of a parent record. There is no error in the code. i'm able to display the data using below code but. i want to display the same output using ...
1
vote
1answer
521 views

Push fail for "force:source:push

I am creating an lwc. Below is the js code import { LightningElement, track } from "lwc"; export default class HelloIteration extends LightningElement { @track contacts = [ { ...
-1
votes
1answer
26 views

Unable to fetch custom object field label and use it in my LWC's html component

I am Unable to fetch custom object field label and use it in my LWC's html component. My objective is to fetch the custom object field label and use it in header of a table in LWC html. Code is like ...
1
vote
1answer
845 views

Spring'21 Use CMS Content in LWC

I wanted to add an image ( CMS Managed ) to a lightning web component. here does my code look like TestCMS.html <template> <img data-contentkey={contentId}> </template> TestCMS....
1
vote
1answer
456 views

lightning-record-edit-form - onsuccess - not receiving updated record

I have a lightning-record-edit-form that includes few standard fields few custom fields. I've register onsuccess(event) function that does some stuff with the newly updated record. I'm accessing this ...
0
votes
0answers
12 views

Is there a way to prevent losing unsaved changes on LWC component inside a VF Page lightning out?

There is a lightning:unsavedChanges component which should prevent from navigating away from a page with a component having unsaved changes. However, this component doesn't work when an Aura component ...
0
votes
1answer
27 views

How to make https optional in lightning input type url in lwc

I want to make https or http optional in my url type input field. But I always get invalid format error. I've tried regex pattern as well, but no luck. HTML Code: <lightning-input type="url&...
0
votes
1answer
18 views

Display alert in account page when related opportunity's stage field is updated

I need to display an alert in account record page when related opportunity's stage field is updated. For this I have created an component and added on the account page. The component is doing apex ...
1
vote
2answers
151 views

Hot to change the button label for lightning-file-upload?

I created file upload function using lightning-file-upload. Its buttons are showed "uplopadFiles" and "ordrop files". I would like to change those to proper Japanese. Could you ...
5
votes
1answer
71 views

How to make a required `lightning-input-field` field not required?

Is it possible to make a <lightning-input-field> where field-name is required (such as Contact.LastName) not required on the UI? I would like the field to not kick in validation rules (client ...
9
votes
5answers
16k views

How do you change the value of a lightning-input-field in javascript?

I have a simple component that creates a record using lightning-record-edit-form. After the record is created, I want to clear the values of the lightning-input-field components. I have tried a few ...
7
votes
1answer
189 views

Is invoking methods on slot children in LWCs possible?

I have an LWC that wraps other child LWCs via a slot: <template> ... <div class="sections-content-container"> ... <slot></slot> ... ...
0
votes
1answer
2k views

Update value of picklist in LWC

I am pretty new to JavaScript & LWC. I have two picklists that I am using to filter results. The filters are working independently of each other. I have two questions: How could I set the value ...
0
votes
1answer
29 views

Why does my Datetime equal 2021-09-01 14:56:21 in one place, but 2021-09-01-565 14:56:21-565 in another?

Thanks for reading, I'm running into an odd occurrence while trying to debug some code that was built out-of-house, and I'm totally stumped. We're setting an apex variable, ID, to String.valueOf(...
0
votes
1answer
36 views

PayPal Smart Buttons used in LWC

I am looking to implement PayPal Smart Buttons to a LWC. https://developer.paypal.com/docs/checkout/ In short, this feature requires two HTML lines in the template: <script src="https://www....