Lightning

LWC: Lightning-Combobox required field validation on submit button

When working with custom Lightning-combobox in LWC most of the time you will face problems making combo box a required field. When using a Lightning-record-edit-form, you usually use lightning-input-field tag and it takes care of all the FLS (Field Level Security) and irrespective of field type it handles every type of field. However, there will be scenarios where lightning-input-field may not be suitable and end up using a custom tag. For instance, a custom lookup field or multi select custom lookup field or a custom record type selection combo box. You end up using a custom solution for these.

Continue reading “LWC: Lightning-Combobox required field validation on submit button”
Lightning

AURA: Clear cache while loading a Lightning Component.

Usually because of cachable=true in apex class, you see results in lightning Aura component same as previous one, Event thought the records are updates, you do not see any updated values. To prevent Lightning aura component from loading component with same results we need to clear cached value.

To clear cache, you have to fire refreshview on component as shown below.

Continue reading “AURA: Clear cache while loading a Lightning Component.”
Lightning

Displaying HTML tags from a text field in lightning component

There will be occasions when you need to display some HTML tags like images or icons based on some condition and you end up using a formula text field to create a dynamic tag and save it as text field. It can also be a Rich-Text-Area field which will be saved as a HTML tag in backend.

Continue reading “Displaying HTML tags from a text field in lightning component”
Lightning

Events in Lightning Component and Visualforce page using Lightning Message Service (LMS)

Events in Lightning Component and Visualforce Pages using Lightning Message Channel

Consider a scenario where you are working on multiple components and in which there are Visualforce pages, Lightning Aura Components, Lightning Web Components. We know that we have Lightning Aura Events (Application Event and Component Event) which works in Lightning Aura Component. But what if there is a scenario where you want to send an event across component whether it is between Aura Component or a Web Component or a Visualforce page. Or combination of all three.

Salesforce has introduced Lightning Web Component Message Service (lightning-message-service). It is used to communicate across the DOM between Visualforce pages, Aura components, and Lightning web components, including components in a pop-out utility bar. To communicate across DOM there should be a channel. And salesforce has provided Lightning Message Channel to communicate.

Continue reading “Events in Lightning Component and Visualforce page using Lightning Message Service (LMS)”