0

So a weird error. I've created a lightning component to provide a custom detail page in communities to control access to fields we couldn't control with standard functionality. Initially, I was going to build the Tabs (like the standard detail layout) into the component using the <lightning:tabset> component, but since I've needed to remove the tab layout.

Here is my current page code: *note, I removed most of the fields just to improve readability, there are more fields in both the view and edit section and the edit section does include inputField components.

<aura:component implements="forceCommunity:availableForAllPageTypes,force:hasRecordId" access="global" controller="CommunityComponentController">
<aura:attribute name="recordId" type="String" />
<aura:attribute name="edit" type="Boolean" default="true"/>
        <aura:if isTrue="{!v.edit}">
            <lightning:recordViewForm recordId="{!v.recordId}" objectApiName="Case">
                <div class="slds-grid slds-gutters_large">
                    <div class="slds-col slds-size_6-of-12">
                        <div class="slds-form-element slds-form-element_edit slds-form-element_readonly slds-hint-parent">
                            <span class="slds-form-element__label">Case Owner</span>
                            <div class="slds-form-element__control">
                                <lightning:outputField fieldName="OwnerId" variant="label-hidden" class="slds-form-element__static"/>
                            </div>
                        </div>
                    </div>
                    <div class="slds-col slds-size_6-of-12">
                        <div class="slds-form-element slds-form-element_edit slds-form-element_readonly slds-hint-parent">
                            <span class="slds-form-element__label">Parent Case</span>
                            <div class="slds-form-element__control">
                                <lightning:outputField fieldName="ParentId" variant="label-hidden" class="slds-form-element__static"/>
                            </div>
                        </div>                            
                    </div>
                </div>
            </lightning:recordViewForm>
            <aura:set attribute="else">
                <lightning:recordEditForm recordId="{!v.recordId}" objectApiName="Case" aura:id="recordHandler" onsuccess="{!c.toggleEdit}">
                <div class="slds-grid slds-gutters_large">
                    <div class="slds-col slds-size_6-of-12">
                        <div class="slds-form-element slds-form-element_edit slds-form-element_readonly slds-hint-parent">
                            <span class="slds-form-element__label">Case Owner</span>
                            <div class="slds-form-element__control">
                                <lightning:outputField fieldName="OwnerId" variant="label-hidden" class="slds-form-element__static"/>
                            </div>
                        </div>                            
                    </div>
                    <div class="slds-col slds-size_6-of-12">
                        <div class="slds-form-element slds-form-element_edit slds-form-element_readonly slds-hint-parent">
                            <span class="slds-form-element__label">Parent Case</span>
                            <div class="slds-form-element__control">
                                <lightning:outputField fieldName="ParentId" variant="label-hidden" class="slds-form-element__static"/>
                            </div>
                        </div>
                    </div>
                </div>
                    <lightning:button label="Cancel" title="Neutral action" onclick="{! c.toggleEdit }"/>
                    <lightning:button variant="brand" label="Save" title="Brand action" type="submit" />
            </lightning:recordEditForm>
            </aura:set>
        </aura:if>
    </aura:component>

So this code right here give me a random error code:

An internal server error has occurred Error ID: 1257794140-105282 (-733430381)

It ONLY does this in the builder and if I publish and view the published community it looks fine with no errors.

HOWEVER, when the component included the tabset component to look like so:

<aura:component implements="forceCommunity:availableForAllPageTypes,force:hasRecordId" access="global" controller="CommunityComponentController">
    <aura:attribute name="recordId" type="String" />
    <aura:attribute name="edit" type="Boolean" default="true"/>
    <lightning:tabset>
        <lightning:tab>
            ... same code as above ...
        </lightning:tab>
    </lightning:tabset>
</aura:component>

It doesn't give an error and I can view the page in the builder.

Any ideas about what I'm doing wrong? My first though was that the <aura:if> tag needed to be wrapped in another component, but I couldn't find reference to this and attempting to wrap it in anything other than the tab/tabset doesn't fix it.

2
  • 2
    My experience with this kind of error it that it often comes from apex server side calls. I can see that you're calling the CommunityComponentController class. What are you doing with it? Apr 30, 2019 at 14:35
  • Nothing now actually, I used to have a custom related list in this page (hint the tabset) but since, I moved it to a separate component. So the controller doesn't do anything now. Removing it's reference didn't do anything though as for the javascript controller: it just has a function called toggleEdit that toggles the value of v.edit
    – stackasaur
    Apr 30, 2019 at 14:44

1 Answer 1

0

So unfortunately, I edited out one of the fields in the original question which caused the issue.

I had this:

<div class="slds-form-element__control">
    <lightning:outputField fieldName="Subject" variant="label-hidden" class="slds-form-element__static"/>
    <button class="slds-button slds-button_icon" title="Edit: Subject" onclick="{!c.toggleEdit}">
        <lightning:buttonIcon iconName="utility:edit" variant="bare"/>
            <span class="slds-assistive-text">Edit: Subject</span>
    </button>                               
</div>

but changing it to this fixed my issue:

<div class="slds-form-element__control">
    <lightning:outputField fieldName="Subject" variant="label-hidden" class="slds-form-element__static"/>
    <button class="slds-button slds-button_icon" title="Edit: Subject" onclick="{!c.toggleEdit}">
        <lightning:icon iconName="utility:edit" size="x-small" iconClass="slds-button slds-button_icon" />
            <span class="slds-assistive-text">Edit: Subject</span>
    </button>                               
</div>

the buttonIcon component broke the page with no actual error. If anyone can explain why?

3
  • Rendering of lightning:buttonIcon inside a html button is not as per salesforce standards, hence its better to use standard base component as much as possible. FYI lightning:button has iconName attribute, using it you could generate a button with icon.
    – Raul
    Apr 30, 2019 at 17:20
  • well not having it in the button tag also didn't work...
    – stackasaur
    Apr 30, 2019 at 19:09
  • It may work now but could break in future, that's the problem with non recommended/standard solution.
    – Raul
    Apr 30, 2019 at 20:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .