+ Start a Discussion
Robin BarnwellRobin Barnwell 

Community Home Page - This component has no data

I've set-up a basic community and got it running.  But when I drag components onto the Home Page I get a message such as this: 

Community Home Page

What I'd like to do is put the user details on the home page for editing.  Can this be done?
For community, you need to implements  forceCommunity:availableForAllPageTypes in cmp.
public class userlist {
    public static List<User> fetchUsers(){
        return [select Id,FirstName, LastName, Email from user limit 10];


<aura:component controller="userlist" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
	  <aura:attribute name="setMeOnInit" type="User[]"  />
 <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
     <table class="slds-table slds-table_bordered slds-table_cell-buffer">
            <tr class="slds-text-title_caps">
                <th scope="col">
                    <div class="slds-truncate" title="User Id">User First Name</div>
                 <th scope="col">
                    <div class="slds-truncate" title="User Name">User Last Name</div>
                 <th scope="col">
                    <div class="slds-truncate" title="User email">User Email</div>
            <aura:iteration items="{!v.setMeOnInit}" var="user">
                 <td><div class="slds-truncate">{!user.FirstName}</div></td>
                   <td><div class="slds-truncate">{!user.LastName}</div></td>
                   <td><div class="slds-truncate">{!user.Email}</div></td>

    doInit: function(component, event, helper) {
        var action = component.get("c.fetchUsers");
        action.setCallback(this, function(response) {
            if (response.getState() == "SUCCESS") {
                var allValues = response.getReturnValue();

<aura:application extends="force:slds">

Robin BarnwellRobin Barnwell
Hello Ghanshyam, many thanks for swift reply.  I got the code working as shown.  But it didn't resolve the issue of using the exsting User Profile component on the home page.

Are you suggest it can't be done and I need to build a custom component to replace the standard component?

User-added image
Robin BarnwellRobin Barnwell
If I change the SQL to just return the current user:
return [select Id,FirstName, LastName, Email from user where id= :UserInfo.getUserId() limit 1];
Then I could change the component to go in edit-mode, that would do the trick
editRecord : function(component, event, helper) {
    var editRecordEvent = $A.get("e.force:editRecord");
         "recordId": component.get("v.contact.Id")
Would you mind helping me by changing the component to edit / save please?