2

Im working on the napili community builder template and looking to add a few custom lightning components.

In particular for the case detail page I want to replace the std record banner component (first image below) with a custom lightning component that fulfils some of the same functionality but empahsises a few differnet fields and has a few custom buttons. std record banner

enter image description here

What I want to have on my custom banner is an edit button which works the same as the edit button on the standard record banner. Ie displays the record in edit mode in a modal. As can be seen from the screenshots above Ive got as far as making my coponent aware of the record detail page its on but I dont know how to form the URL to open the record in edit mode in the community. Easy to do in regular non-communities Salesforce but no idea what to do here.

Any help around the URL I need to edit the record much appreciated. (sure this mut have been asked but cant seem to find it)

Component

<aura:component implements="forceCommunity:availableForAllPageTypes,force:hasRecordId" access="global" controller='LCCaseDetailContApex'>
<ltng:require styles="/resource/SLDS203/assets/styles/salesforce-lightning-design-system-ltng.css" />
<aura:attribute name="debugString" type="String" default="Not Set" />
<aura:attribute name="borderColour" type="String" default="grey"/>
<aura:attribute name="record" type="Case"/>
<aura:attribute name="caseID" type="String" required="true"/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />

<div class="CaseControls">
    <div class="slds-page-header" role="banner">
        <div class="slds-grid slds-grid--vertical-stretch">
            <div>
                <p class="slds-text-heading--label">Case {!v.record.CaseNumber} - {!v.record.Subject }</p>
                <h1 class="slds-text-heading--medium">Currently allocated to {!v.record.Allocated_To__c}</h1>
            </div>
            <div class="slds-col--bump-left">
                    <ui:button aura:id="button" label="Show Guidance" press="{!c.doGuidance}"/>
                    <ui:button aura:id="button" label="Edit Case" press="{!c.edit}"/>
                    <ui:button aura:id="button" label="Submit Case" press="{!c.doSubmit}"/>
                    <ui:button aura:id="button" label="Withdraw Case" press="{!c.doWithdraw}"/> 
            </div>
        </div>            
    </div>
</div>

1

Use the force:recordEdit component

Generates an editable view of the specified Salesforce record.

A force:recordEdit component represents the record edit UI for the specified recordId. This example displays the record edit UI and a button, which when pressed saves the record.

https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_force_recordEdit.htm

You may have to use it in combination with a modal window as I am not sure the component generates the modal on its own or opens in a new window

2
  • Great, just what I needed. – Doug Oct 11 '16 at 23:16
  • .. posted too early. Was going to say you are correct, need to combine this with a model as this component just displayed the case record in edit mode wherever it is placed. But thats fine, getting the record up in edit mode was exactly what I was looking for with this question. – Doug Oct 11 '16 at 23:20

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.