function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nevin O'Regan 3Nevin O'Regan 3 

Error When Adding A Custom Component To Community Page

Hi guys,

I've created a custom screen flow and I want to add it to a community page, launched from a custom button on the Homepage. 
The flow guides users through creating a case. I am getting the following error when I add the component to the page: "Action failed: c:CustomCaseCommunityComponent$controller$init [flowData is not defined]"

This is my component. 

<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,forceCommunity:availableForAllPageTypes,force:hasRecordId,force:lightningQuickActionWithoutHeader" access="global">

    <aura:handler name="init" value="{!this}" action="{!c.init}"/>
    <lightning:flow aura:id="flowData"/>
    
</aura:component>


({
init : function (component) {
var flow = component.find(flowData);
flow.startFlow(CaseFlow);
},
})
Best Answer chosen by Nevin O'Regan 3
SUCHARITA MONDALSUCHARITA MONDAL
Nevin,
Just update your code as below:
var CaseFlow = component.find("flowData");
flow.startFlow(CaseFlow);  

Thanks,
Sucharita
 

All Answers

SUCHARITA MONDALSUCHARITA MONDAL

Hi Nevin,
just add double quotes as for aura:id

var flow = component.find("flowData");

Thanks,
Sucharita

Nevin O'Regan 3Nevin O'Regan 3
Hi Sucharita,

I've tried this but it's still the same. When I add the component to the homepage of my community it doesn't actually even appear on the community, i get an error message in the content section within the Page Structure.

User-added image

User-added image
Nevin O'Regan 3Nevin O'Regan 3
Do I need to add a Helper method to this?
SUCHARITA MONDALSUCHARITA MONDAL
Nevin,
Just update your code as below:
var CaseFlow = component.find("flowData");
flow.startFlow(CaseFlow);  

Thanks,
Sucharita
 
This was selected as the best answer