New answers tagged

0 votes

Navigation while lightning-flow ends

Use Renderedcallback to navigate to the record
user avatar
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?
user avatar
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://...
user avatar
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 = '...
user avatar
  • 718
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 ...
user avatar
  • 1
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 ...
user avatar
  • 429k
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&...
user avatar
  • 531
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" ...
user avatar
  • 61
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/...
user avatar
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 ...
user avatar
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; } ...
user avatar
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 ...
user avatar
  • 429k
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 ...
user avatar
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')] ...
user avatar
  • 429k
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
user avatar
  • 2,318
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() ...
user avatar
  • 429k
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.
user avatar
  • 429k
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((...
user avatar
  • 531
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.
user avatar
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 ...
user avatar
  • 129k
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 ...
user avatar
  • 531
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-...
user avatar
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.
user avatar
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&...
user avatar
  • 86
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/
user avatar
  • 531
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 ...
user avatar
  • 2,421
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 ...
user avatar
  • 429k
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}]);
user avatar
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....
user avatar
  • 2,050
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 ...
user avatar
  • 1,195
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() ...
user avatar
  • 531
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....
user avatar
  • 1,028
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(); ...
user avatar
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 ...
user avatar
  • 429k
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 ...
user avatar
  • 10.4k
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 ...
user avatar
  • 176
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 ...
user avatar
  • 429k
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 ...
user avatar
  • 429k
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(...
user avatar
  • 429k
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: ...
user avatar
  • 531
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 ...
user avatar
  • 81
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 ...
user avatar
  • 17.5k
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 ...
user avatar
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 : ...
user avatar
  • 81
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; ...
user avatar
  • 1,028
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. ...
user avatar
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.
user avatar
  • 11
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 ...
user avatar
  • 1,339
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(...
user avatar
  • 429k
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 ...
user avatar
  • 26.6k

Top 50 recent answers are included