Concepts or coding lessons of Salesforce that you can implement easily

Easily Get Custom Labels in LWC

In this blog we are going to learn how we can access custom labels in LWC

To access custom label use below syntax:

import varName from '@salesforce/label/c.companyDiscount';

Create Custom Label :



customLabels.html

<template>
<div class="slds-m-around_small"> 
Company Discount is => {discountDetails}
</div>
</template>

customLabels.js

import { LightningElement, track } from 'lwc';

import companyDiscount from '@salesforce/label/c.companyDiscount';

export default class CustomLabels extends LightningElement {

    @track discountDetails = companyDiscount;

}

Output:




 

Subscribe blog for More updates !!! 



Read More: WhatsApp on Salesforce Integration in 5 Steps
                    Which Salesforce API Do I Use in Integration?
                    When To Use Salesforce REST API  
                   When To Use Salesforce SOAP API 
                   When To Use Salesforce Bulk API 


Latest Salesforce Interview Questions and Answers:

loading...

No comments:

Post a Comment