Sunday, June 25, 2017

Passing Lightning Component attribute value from VF page

As we know that we can include Lightning component in VF page by creating a Lightning App and add it to VF page by specify particular script. Sometime it is required to pass some dynamic value to component so that it can behave differently based on component attribute value.

Below is sample code which explains how to passed component attribute from VF page. Here we are passing Account name to lightning component by using standard controller on VF page.

In order to test the output, open below URL:
https://your-domain-url/apex/lightningVF?id=xxxxxxxxx

where xxxxxxxxx is Account Id.

Note:
  • Whenever you use extends="ltng:outApp" in Lightning app,  SLDS is automatically get applied your components.
  • If you don't want to apply SLDS, just use extends="ltng:outAppUnstyled"
  • If you are having org namespace, then always use " <namespace>:lightningComponentName" instead of  "c:lightningComponentName"  in VF page.

Hope this will help!!

2 comments:

  1. Salesforce is a global cloud computing company in California, United States. This corporation is best known for its Customer Relationship Management (CRM) product, now it’s expanded to commercial application. Being most popular cloud based CRM tool, it is used in most of the organizations to boost their business process. Thus, it increases the demand of trained and certified Salesforce developers and administrators.
    Salesforce Training in Chennai|salesforce administrator training in chennai

    ReplyDelete