• WHO WE ARE
  • WHAT WE DO
    • Salesforce
      • Implementations
        • Sales Cloud
        • Service Cloud
        • CPQ
        • Field Service Lightning
        • Field Service for SMEs
      • Developments
        • Salesforce Customization
        • Custom Application Development
        • AppExchange Product Development
      • Migrations
        • Classic to Lightning Migration
        • Other Systems to Salesforce Migration
      • Integrations
    • Data Science
      • BI Solutions
      • AI/ML solutions
      • Agentic AI
  • HOW WE DO
    • Delivery Model
    • Our Works
  • REACH US
    • Contact Us
    • Careers
  • BLOG
    • WHO WE ARE
    • WHAT WE DO
      • Salesforce
        • Implementations
          • Sales Cloud
          • Service Cloud
          • CPQ
          • Field Service Lightning
          • Field Service for SMEs
        • Developments
          • Salesforce Customization
          • Custom Application Development
          • AppExchange Product Development
        • Migrations
          • Classic to Lightning Migration
          • Other Systems to Salesforce Migration
        • Integrations
      • Data Science
        • BI Solutions
        • AI/ML solutions
        • Agentic AI
    • HOW WE DO
      • Delivery Model
      • Our Works
    • REACH US
      • Contact Us
      • Careers
    • BLOG
  • [email protected]
  • (+91) 44-49521562
Merfantz - Salesforce Solutions for SMEs
Merfantz - Salesforce Solutions for SMEs
  • WHO WE ARE
  • WHAT WE DO
    • Salesforce
      • Implementations
        • Sales Cloud
        • Service Cloud
        • CPQ
        • Field Service Lightning
        • Field Service for SMEs
      • Developments
        • Salesforce Customization
        • Custom Application Development
        • AppExchange Product Development
      • Migrations
        • Classic to Lightning Migration
        • Other Systems to Salesforce Migration
      • Integrations
    • Data Science
      • BI Solutions
      • AI/ML solutions
      • Agentic AI
  • HOW WE DO
    • Delivery Model
    • Our Works
  • REACH US
    • Contact Us
    • Careers
  • BLOG

Integrating Lightning Web Components (LWC) with Visualforce Pages in Salesforce

  • July 18, 2024
  • Tech Blogger
  • Field Service Management, Salesforce Admin Tutorial, Salesforce Developments Tutorial
  • 0

Integrating Lightning Web Components (LWC) with Visualforce Pages in Salesforce

Integration :

In Salesforce, integrating Lightning Web Components (LWC) with Visualforce pages can enhance the user experience by leveraging the strengths of both frameworks. One common requirement is to pass data, such as Pass current record ID from LWC to Visualforce page. This allows for seamless navigation and data handling across different parts of the Salesforce application. In this guide, we will walk through the process of creating an LWC that navigates to a Visualforce page, passing the current record ID as a URL parameter. Additionally, we will demonstrate how to retrieve and use this record ID within the Visualforce page. This integration ensures that the Visualforce page can perform relevant actions or display data based on the passed record ID, thus creating a cohesive and efficient user workflow.

Source Code:

LWC -Html:

<template>

<div class=”iframe-container”>

<iframe id=”vfFrame” src={vfHost} class=”iframe” onload={handleIframeLoad}></iframe>

</div>

</template>

LWC –Js:

import { LightningElement, api } from ‘lwc’;

export default class MapContainer extends LightningElement {

@api recordId;

origin=DomainCreator.getVisualforceHostname(null);

vfHost= window.location.origin+’your_vfName’;

handleIframeLoad() {

console.log(‘iframe loaded’);

this.sendData();

}

sendData() {

this.template.querySelector(‘iframe’).contentWindow.postMessage(this.recordId,this.origin);

}

}

VisualForce Page:

<apex:page  showHeader=”false” standardStylesheets=”false”>

window.addEventListener(‘message’, function(event) {

console.log(‘Received Record :  ‘+ event.data);//record id from lwc

});

</apex:page>

 

See how FieldAx can transform your Field Operations.

Try it today! Book Demo

You are one click away from your customized FieldAx Demo!

Conclusion:

By following the steps outlined in this guide, you can successfully Pass current record ID from LWC to Visualforce page in Salesforce. This integration leverages the NavigationMix in in Lightning Web Components to navigate to a Visualforce page, passing necessary parameters through the URL. The Visualforce page, with its Apex controller, retrieves these parameters to perform relevant actions or display data. This approach not only bridges the gap between the modern Lightning Web Component framework and the traditional Visualforce pages but also enhances the functionality and user experience of your Salesforce application.

Author Bio

Tech Blogger
+ Recent Posts
  • Comprehensive Overview of Salesforce Agent-Force Platform
    June 12, 2025
    Comprehensive Overview of Salesforce Agent-Force Platform
  • Salesforce GraphQL Revolutionizing Data Queries in CRM
    June 6, 2025
    Salesforce GraphQL: Revolutionizing Data Queries in CRM
  • Unlocking the Power of Dynamic Forms in Salesforce Lightning App Builder
    May 29, 2025
    Unlocking the Power of Dynamic Forms in Salesforce Lightning App Builder
  • Einstein Activity Capture Boosting Productivity & Relationship Intelligence
    May 22, 2025
    Einstein Activity Capture: Boosting Productivity & Relationship Intelligence
Tags: Merfantz Technologies
  • Previous Salesforce Latest Release Update for SOQL
  • Next Essential Steps for a Successful Salesforce Migration in 2024
Merfantz Technologies is a leading Salesforce consulting firm dedicated to helping small and medium enterprises transform their operations and achieve their goals through the use of the Salesforce platform. Contact us today to learn more about our services and how we can help your business thrive.

Discover More

Terms and Conditions
Privacy Policy
Cancellation & Refund Policy

Contact Info

  • No 96, 2nd Floor, Greeta Tech Park, VSI Industrial Estate, Perungudi, Chennai 600 096, Tamil Nadu, INDIA
  • (+91) 44-49521562
  • [email protected]
  • 9:30 IST - 18:30 IST

Latest Posts

Comprehensive Overview of Salesforce Agent-Force Platform
Comprehensive Overview of Salesforce Agent-Force Platform June 12, 2025
Salesforce GraphQL Revolutionizing Data Queries in CRM
Salesforce GraphQL: Revolutionizing Data Queries in CRM June 6, 2025
Unlocking the Power of Dynamic Forms in Salesforce Lightning App Builder
Unlocking the Power of Dynamic Forms in Salesforce Lightning App Builder May 29, 2025

Copyright @2023 Merfantz Technologies, All rights reserved