Instantly share code, notes, and snippets.

Embed
What would you like to do?
<template>
<iframe
src={facebookSrc}
width="340"
height="500"
style="border:none;overflow:hidden"
scrolling="no"></iframe>
</template>
import { LightningElement ,api, wire} from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
import FBURL from '@salesforce/schema/Account.Facebook_Page_URL__c';
export default class Facebooktimeline extends LightningElement {
@api recordId;
@wire(getRecord, { recordId: '$recordId', fields: [FBURL] })
Account;
get facebookSrc() {
if( typeof this.Account.data !== 'undefined' ){
return 'https://www.facebook.com/plugins/page.php?href='+this.Account.data.fields.Facebook_Page_URL__c.value+
'&tabs=timeline&width=340&height=500&small_header=true&adapt_container_width=true&hide_cover=true&show_facepile=false&appId';
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="facebooktimeline">
<apiVersion>45.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__AppPage</target>
<target>lightning__RecordPage</target>
<target>lightning__HomePage</target>
</targets>
</LightningComponentBundle>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment