Skip to main content
New
Stack Overflow Jobs powered by Indeed: A job site that puts thousands of tech jobs at your fingertips (U.S. only). Search jobs
12 votes
Accepted

LWC onClick for div not returning id or data-id for either target or currentTarget

The problem with your code is in key attribute you have passed {it.value.id} where as for data-id you have passed {it.value.Id}. Both are different as you have used capital and small i . JavaScript is ...
sanket kumar's user avatar
  • 15.4k
11 votes
Accepted

Iterate a Javascript map in Lightning Web Component template

No, it is not possible to iterate over a Map. You need to convert the Map to an Array first. var fields = { 'abcd1234': { Id: 'abcd1234', field1__c: 'bar', field2__c: 'bar' , field3__c:'abc'}, ...
sfdcfox's user avatar
  • 494k
8 votes
Accepted

Using arithmetic comparison in if:true statement in Lightning web component

LWC is not supporting any conditional operators or expression evolution methods in markup. To achieve this you should develop a child component and pass the data and index attributes to child ...
Yaswanth Tikkisetti's user avatar
7 votes
Accepted

How is the <template> tag used in lwc different from one used in web components?

In LWC, the LightningElement's default rendering lifecycle handles this for you. This means that you get to do less typing. However, if you want to include a different template, perhaps based on some ...
sfdcfox's user avatar
  • 494k
6 votes
Accepted

Lightning web component - how to get width of an element in javascript

The style attribute tells you what the style was set to. To get the actual current size, use getBoundingClientRect(): console.log(mapWidth.getBoundingClientRect().width); Note that this will be an ...
sfdcfox's user avatar
  • 494k
5 votes

LWC: Inside an HTML template for-loop, set loop variable property to new user-typed input element value?

Here's a Playground that demonstrates how to set an onchange handler like what you're asking for: import { LightningElement, track } from 'lwc'; export default class App extends LightningElement { ...
sfdcfox's user avatar
  • 494k
5 votes

LWC Template if:true Directive not working

If you initialize courses with an array, it is a truthy value, either change the assignment to null/undefined or simply change the directive to if:true={courses.length} Also, @track is required when ...
Prashant Kashyap's user avatar
4 votes

Override background image/color in the community using the Napili template

To update the background, in the branding editor, there should be an "edit" pencil or brush referring to "Edit CSS" from there you can change the background with appropriate css styling. for Ex. ...
glls's user avatar
  • 20.2k
4 votes
Accepted

Syntax guide for working with Salesforce Web Components

UPDATE My initial understanding of the wired property was incorrect. While trying to reproduce the issue, I had used data.length and thus had come to the conclusion that unless the wired property ...
Jayant Das's user avatar
  • 30.6k
4 votes

How to use '==' in Template string in LWC?

How to use '==' in Template string in LWC? You don't. You need to instead manipulate your data such that you can evaluate it as true/false directly. Something like this: this.Products = this.Products....
sfdcfox's user avatar
  • 494k
3 votes
Accepted

LWC: conditional display of message

You don't need to do anything in your code. You can set this condition in Lightning App Builder. After you click and drag the component on to the page, click on it again to show the menu on the right. ...
sfdcfox's user avatar
  • 494k
3 votes
Accepted

Remove email signature after sending single email with email template

depending on how you are sending the email (eg. javascript, Apex Callout) If you're using apex... The SingleEmailMessage has the Email class as a parent class. Therefore you can use the method ...
KDH's user avatar
  • 245
3 votes
Accepted

Custom Font not working In Custom HTML email template

This is not related to Salesforce, but to web-safe fonts. Majority of Email clients have no support for custom fonts, even today. While there are few that partially support them, Gmail ...
Rain's user avatar
  • 5,775
3 votes
Accepted

HTML template in marketing cloud

This is the expected behavior. Probably there is just a misunderstanding of nomenclature: Templates are not meant to paste full messages in. For this, you would create a message of type HTML Paste. ...
Jonas Lamberty's user avatar
3 votes

I would like to disable a custom button once after clicking it in LWC?

Boolean values, like disabled, can be set to true or false. When true, they act as if they are present, and when false, act as if they are not. Example. import { LightningElement } from "lwc"...
sfdcfox's user avatar
  • 494k
3 votes
Accepted

LWC: Can a "<template for:each=" be used with an inner "<template for:each=" where the inner for-each gets its value using the key from the outer?

This is not possible in Aura or LWC, actually. for:each must have an Array to work off of. That means you must structure your data such that: <template for:each={transactions} for:item="...
sfdcfox's user avatar
  • 494k
3 votes
Accepted

Record page link is not appearing in the email

Your code is outputting something like: <a href= https://my.salesforce.com/12345>Order Order Page</a> Which is not proper HTML, so it gets rendered incorrectly. It should look like: <a ...
sfdcfox's user avatar
  • 494k
3 votes
Accepted

How to do binary conditional rendering lightning web component

you will want to use a getter in order to compute an expression and return a boolean value. For ex. js file get verifySomething() { return prop.object === 'Contact' } template <...
glls's user avatar
  • 20.2k
2 votes

Creating custom Community Template

Kokua and Koa are no longer offered. From the Napili template, you can customize the appearance and functionality quite easily. You also have access to Salesforce Tabs + Visualforce. Depending on ...
glls's user avatar
  • 20.2k
2 votes
Accepted

Creating custom Community Template

I think this is what you are looking for: Quote from the Set Up and Manage Salesforce Communities - communities.pdf (first link below) Community Builder makes it super easy to customize your ...
ChristianJuul's user avatar
2 votes

Duplicate Rule not firing for sample data Installed from Trialforce Template

I suspect you need to log a case with Salesforce, because this sounds like a bug. My immediate guess is that the back end tables that power Duplicate Management aren't populated by the sample data, ...
sfdcfox's user avatar
  • 494k
2 votes
Accepted

How to add opportunity owner in email template?

When using the Owner field in an Email Template you have a few options of what to display in the email. If you would like to show the full name of the owner. You would need to use {!Opportunity....
cmmoutes13's user avatar
  • 1,047
2 votes

Syntax guide for working with Salesforce Web Components

You need to check if the objects are yet populated: get hasCourses() { return this.studentCourseRelationships && this.studentCourseRelationships.data && this....
sfdcfox's user avatar
  • 494k
2 votes
Accepted

LWC: Inside an HTML template for-loop, set loop variable property to new user-typed input element value?

As suggested by sfdcfox you can use, data attributes, if you dont wanna use data attribute you can use lightning-input name attribute instead. <template for:each={wrapped_records} for:item="...
Pranay Jaiswal's user avatar
2 votes
Accepted

template if:true with get variable is not working

I think this might help. Boolean attributes on standard HTML Elements are set to true by adding the attribute to the element. The absence of the attribute defaults the attribute to false. ...
Atlas Can's user avatar
  • 1,877
2 votes
Accepted

Template Expression Doesn't allow for Computer Expression in lightning-input-field

Your problem is the attribute expression value={rec.fields[field].value}. What you need to do is shift the expression handling into your JavaScript so you have a simple array of tuples to iterate, ...
Phil W's user avatar
  • 36.7k
1 vote
Accepted

How to dynamically create lightning cards in lwc, with 2 cards in a single row using grid

I have tried this and it works HTML Code- <template> <div class="slds-grid slds-wrap"> <template for:each={contacts} for:item="contact"> ...
Sahil Malhotra's user avatar
1 vote
Accepted

Change a variable without showing it in ISML

It's discouraged to do business logic within templates. But yes, you can do scripting without output. To do so, just wrap your code with <isscript></isscript> eg: <isscript> var ...
sholsinger's user avatar
1 vote

Custom Lightning Record Page Template not showing up in Template Switching Wizard

It may just take time for it to show up in the template list. I tested with a new custom template a few days ago, and it showed up immediately for new Lightning record pages, but it did not show as an ...
Zosoled's user avatar
  • 93
1 vote

Calling Email template in Visual Force page using Iframe

Instead of using the sfdcBaseURL, you can use the custom label where you store the production url and then use it in the source. Or You can use the URL.getSalesforceBaseUrl().getHost() function to ...
sohail patel's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible