0

I am an admin coming in after a third-party developer created a lot of custom content for our org's community portal. I am trying to make an addition to our portal content by accessing one of the lightning components the developer created. A snippit of the code is listed below:

        <aura:if isTrue="{!v.getCoach}">
        <div class="AAA_profile">
            <figure class="AAA_profile-image">
                <img src="{!v.infoCoach.FullPhotoUrl}" />
                <figcaption style="{! 'color: #' + v.themeColor}">College Coach</figcaption>
            </figure>
            <div class="AAA_profile-info">
                <div class="profile-name">{!v.infoCoach.Name}</div>
                <div class="profile-phone">{!v.infoCoach.Phone}</div>
                <div class="AAA_btn-container">
                    <button class="{! join(' ' , 'AAA_btn', 'theme' + v.themeColor)}" onclick="{!c.jumpToContact}">Contact</button>
                </div>
            </div>
        </div>
        </aura:if>

My goal is do add a new line after this code line

<dive class="profile-phone">{!v.infoCoach.Phone}</div>

That references another part of the user record. For example

<dive class="profile-phone">{!v.infoCoach.Custom_Field__c}</div>

Unfortunately, no dot notation fields I have tried using this method have worked. Raw text entered in works fine, such as the example below, but any dot notation other than .Name and .Phone come up blank on the community portal facing side.

<dive class="profile-phone">Raw text example</div>

I have confirmed that the custom field I am trying to access (.Custom_Field__c) is visible for customer community users, so I am stumped on why the custom field does not populate.

Edit: The HELPER code I found for coach info is as follows:

/* Download the information about the coach*/

loadCoach: function(cmp, ev, helper) {
    var action = cmp.get('c.getCoachProfile');

    action.setCallback(this, function(resp) {
        cmp.set('v.infoCoach', resp.getReturnValue());
    });

    $A.enqueueAction(action);
},
  • 1
    Do you know how is v.infoCoach populated? If it does not contain the field that you are trying to use on the component retrieved from the object, chances are you will get blank value there. – Jayant Das Apr 5 '18 at 20:44
  • I'm not very knowledgable on this front, but in the "Helper" section of the component, I found code that I added to the main question (the "Edit" section) – Jwok Apr 5 '18 at 20:53
  • 1
    Okay, so look for "controller=" in your lightning component, that should be an apex class. Once you trace that, go to "getCoachProfile()" method in that class and see what are the fields those are retrieved in there. That's the place where you need to add the custom field that you want to use in the component. – Jayant Das Apr 5 '18 at 20:56
  • 1
    In "COMPONENT" I see <aura:component implements="forceCommunity:availableForAllpageTypes" controller="AAA_ProfileController">, but I don't see "AAA_ProfileController" anywhere else in the component – Jwok Apr 5 '18 at 20:59
  • 1
    You need to go to AAA_ProfileController which is an apex class. Within that class, look for the method getCoachProfile, where you will find all the fields viz., Name, Phone, etc. being retrieved most likely in a SOQL. If you can get hold of that SOQL, that's the place where you will need to add your custom field and use that in the component. – Jayant Das Apr 5 '18 at 21:01
3

Based on the information you have provided:

In "COMPONENT" I see aura:component implements="forceCommunity:availableForAllpageTypes" controller="AAA_ProfileController", but I don't see "AAA_ProfileController" anywhere else in the component

You need to go to AAA_ProfileController which is an apex class. Within that class, look for the method getCoachProfile, where you will find all the fields viz., Name, Phone, etc. being retrieved most likely in a SOQL. If you can get hold of that SOQL, that's the place where you will need to add your custom field and use that in the component. You don't require any change in the helper JS of the component.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.