May 2020

Salesforce

Subscribe, Unsubscribe MessageChannel in LWC, Aura and Visualforce Page in Salesforce

GitHub Source Code:https://github.com/magulan/Salesforce-Message-ChannelSampleChannel.messageChannel-meta.xml:<?xml version="1.0" encoding="UTF-8"?><LightningMessageChannel xmlns="http://soap.sforce.com/2006/04/metadata">    <masterLabel>SampleChannel</masterLabel>    <isExposed>true</isExposed>    <description>This is a sample Lightning Message Channel.</description>    <lightningMessageFields>        <fieldName>variable1</fieldName>        <description>Variable 1</description>    </lightningMessageFields>    <lightningMessageFields>        <fieldName>variable2</fieldName>        <description>Variable 2</description>    </lightningMessageFields></LightningMessageChannel>Aura:Component:<aura:component implements="flexipage:availableForAllPageTypes" access="global">        <aura:attribute type="String" ....

Salesforce

How to pass record Id in Flow to Lightning Component in Salesforce?

Aura Component Code: FlowComponent.cmp: <aura:component implements="lightning:availableForFlowScreens"> <aura:attribute name="RecordId" type="String"/> <lightning:recordViewForm recordId="{! v.RecordId }" objectApiName="Account"> <div class="slds-box"> <lightning:outputField fieldName="Name" /> <lightning:outputField fieldName="Industry" /> </div> </lightning:recordViewForm> </aura:component> FlowComponent.design: <design:component> <design:attribute name="RecordId" label="Record ....

Salesforce

lightning:treegrid select child rows upon selecting parent row in Salesforce

Sample Code:Example.cmp:<aura:component implements="force:appHostable"                 controller="AccountListController">     <aura:attribute name="gridColumns" type="List" />    <aura:attribute name="gridData" type="Object" />    <aura:attribute name="selectedRows" type="list" />        <aura:handler name="init" value="{!this}" action="{!c.fetchAccounts}"/>        <lightning:treeGrid columns="{! v.gridColumns }"        data="{! v.gridData }"        ....

Salesforce

lightning-record-form LWC in Salesforce Community

Sample Code:LWC HTML:<template>    <div class="slds-box slds-theme_default">        <lightning-record-form record-id={recId}                            object-api-name={objectName}                            layout-type="Full"                            mode="view"                            columns="2"                            density="comfy"></lightning-record-form>    </div></template>LWC JavaScript:import { LightningElement, wire, track } from 'lwc';import { CurrentPageReference } from 'lightning/navigation';export default class RecordPageLWC ....