• James Keogh
  • 0 Points
  • Member since 2019

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
  • 1
Hi All,

I am trying to create a twitter feed component for use in Salesforce communities and because I need to use the JS supplied by Twitter I am using a Lightning:container, however I cannon't seem to get the JS to load for me and I have been trying for days.

I have created an index.html file and zipped that up with the "widgets.js" file supplied by Twitter and saved it to the static resources in a file called spptest. I have also whitelisted twitter in the community CSP. Please see my code below and If you can spot any issues with it please let me know.

Thanks, James

<!DOCTYPE html>
    <a class="twitter-timeline" href="https://twitter.com/TwitterDev?ref_src=twsrc%5Etfw">Tweets by TwitterDev</a>

<aura:component implements="forceCommunity:availableForAllPageTypes, flexipage:availableForAllPageTypes" access="global">
        <lightning:container src="{!$Resource.spptest + 'index.html'}"/>
        <aura:attribute name="TwitterHandle" type="String" />


<design:component label="Twitter Feed 2.0">
        <design:attribute name="TwitterHandle" label="Twitter Handle" description="Please insert the Twitter handle you would like to display" />
            <design:supportedFormFactor type="Large"/>
            <design:supportedFormFactor type="Small"/>

This is the result I get when the component is in the community:
User-added image
Hi All,

I am trying to create a Lightning Web Component for a salesforce community in Visual Studio but I believe that there is an issue with my JS somewhere that is causing it to fail.

I also plan on having an input parameter in the compontent and use a key/value pairing to replace the placeholder account for the twitter feed based upon the user defined input, but that is not currently fully configured.

import { LightningElement, api, } from 'lwc';
import { loadScript } from 'lightning/platformResourceLoader';
import Twitterjs from '@salesforce/resourceUrl/Twitterjs';

export default class Twitter extends LightningElement {

    Twitterjs = false;

    renderedCallback() {
        if (this.Twitterjs) {
        this.Twitterjs = true;

            loadScript(this, Twitter + 'twitter.js'): Promise
            .then(() => {
            .catch(error => {
                    new ShowToastEvent({
                        title: 'Error loading Twitter',
                        message: error.message,
                        variant: 'error'
@api twitterhandle
    <lightning-input-field field-name="twitterhandle"></lightning-input-field>
    <a class="Twitter" lwc:dom="manual" data-height="500" data-theme="light" href="https://twitter.com/TwitterDev?ref_src=twsrc%5Etfw" data-chrome="nofooter noborders">Tweets by TwitterDev</a>

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <masterLabel>Twitter feed</masterLabel>
    <description>This module allows you to embed a twitter feed in your community</description>
    <targetConfig targets="lightningCommunity__Page">
        <property name="backgroundColor" type="Color" default="rgba(0, 255, 255, 0)">
                <supportedFormFactor type="Large" />
                <supportedFormFactor type="Small" />
    <targetConfig targets="lightningCommunity__Default">
        <property name="backgroundColor" type="Color" default="rgba(0, 255, 255, 0)">
                <supportedFormFactor type="Large" />
                <supportedFormFactor type="Small" />

It would be great if anyone could point out any glaring errors as I have been troubleshooting this for a number of hours now without any success.

Hey Guys,

I am trying to modify the CSS in a managed package that is saved as a visual force page, it is controlled by a custom controller that is hidden to me. 

I have cloned the VF page and changed the CSS code I need to, so how do I now point to this new VF page instead of the old one in the managed package. 

Hi Folks,

I am building a LWC to load external JS script file in LWC. However whenever loadScript function is executing it is failing to load and there is not error received.

import { LightningElement, track  } from 'lwc';
import { loadScript } from 'lightning/platformResourceLoader';
import BrandfolderJS from '@salesforce/resourceUrl/BrandfolderJS';

export default class brandFolderLink extends LightningElement {
    @track blnBrandfolderJSInitialized = false;
    renderedCallback() {

        if (this.blnBrandfolderJSInitialized) {
        this.blnBrandfolderJSInitialized = true;

        loadScript(this, BrandfolderJS)
        .then(() => {
        .catch(error => {

JS file from Static Resource - Brandfolder JS (https://cdn.brandfolder.com/bf.min.js)
I have created JS file as static resource (BrandfolderJS) and using it in LWC.

LWC is added to App Builder Page/Home Page and trying to load, however it is going to catch block in loadScript method without any error. Error variable is undefined.

Can you please help?

Thank you,
Jigar Lakhani