Posts

Showing posts from June, 2024

Bind HTML elements in LWC (BASIC LWC)

Image
            Bind HTML elements in LWC  Welcome to our blog! Today, we’re diving into a fundamental aspect of Lightning Web Components (LWC) - binding HTML elements. If you're a Salesforce developer or just getting started with LWC, understanding how to bind data between your JavaScript and HTML is crucial for creating dynamic and interactive applications. What is Data Binding in LWC? Data binding in LWC refers to the process of synchronizing data between the component's JavaScript class and its HTML template. This synchronization ensures that any changes in the data are automatically reflected in the user interface, and vice versa. Types of Data Binding One-way Data Binding In one-way data binding, the data flows in a single direction: from the JavaScript class to the HTML template. This is useful for displaying static data or data that doesn't need to change dynamically. Implementing One-way Data Binding Let’s start with a simple example of one-way da...

Building a Real-Time Train Status Tracker with Salesforce LWC and Apex

Image
  Building a Real-Time Train Status Tracker with Salesforce LWC and Apex In this tutorial, we'll walk through the process of creating a real-time train running status tracker using Salesforce Lightning Web Components (LWC) and Apex. This tracker will fetch live train data from an external API and display it in Salesforce. Follow along to enhance your Salesforce skills and build a practical application. Step 1: Setting Up Remote Site Settings To begin, we need to set up remote site settings in Salesforce to allow external API calls. Navigate to Setup in Salesforce. Search for Remote Site Settings in the Quick Find box. Click New Remote Site . Enter the following details: Remote Site Name : TrainStatusAPI Remote Site URL : https://rappid.in Click Save . Step 2: Creating the Apex Class Next, we'll create an Apex class to make an API call and fetch train details. < template >               < lightning-card   t...