• Ruud Dirksen 4
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
Hi,

I'm trying to recreate the standard Related Record component that we have available in lightning since it's not functioning properly for Person Accounts. The component should display information of the related Account when a user is working on a Case. I thought it would be a good idea to make a lightning:recordViewForm component and diplay all the fields as lightning:outputFields. 

Actually creating the layout shouldnt be a problem. I'm having trouble getting to the AccountId and placing it in the recordId attribute. My code so far:
<aura:component implements="flexipage:availableForAllPageTypes, force:hasRecordId" access="global">

    <lightning:recordViewForm recordId="???" objectApiName="Account">
        <div class="slds-box slds-theme_default">
            <lightning:outputField fieldName="Name" />
            <lightning:outputField fieldName="Phone"/>
            <lightning:outputField fieldName="PersonEmail" />
            <lightning:outputField fieldName="PersonBirthdate" />
        </div>
    </lightning:recordViewForm>
    
</aura:component>
I guess I should use force:recordData somehow but don't know enough about lightning components to get this to work. Help is much appriciated!

Thanks!

 
Hi,

I was able to create a lightning:picklistPath that displays a path based on a Case picklist, the user is able to update the picklist by clicking on the path. The name of the picklist, and the current picklist value of the field is also displayed:

User-added image

I would like the 'Current Step' part to be hidden. This seems to be part of the base component somehow, and i'm not sure how to hide it. I imagine I will need CSS to manage this, i'm really new to CSS and lighting components in general and cant figure it out. When I inspect the page i see the following class is linked to that part of the component: 

User-added image
Component:
<aura:component implements="flexipage:availableForAllPageTypes,force:hasRecordId" access="global" >
<lightning:notificationsLibrary aura:id="notifLib"/>
<aura:attribute name="picklistField" type="object"/>
    
<force:recordData aura:id="record"
    layoutType="FULL"
    recordId="{!v.recordId}"
    targetFields="{!v.picklistField}"
    mode="EDIT"/>
    
<lightning:picklistPath recordId="{!v.recordId}"
        				variant="linear"
        				picklistFieldApiName="CSJ_Steps__c"
                onselect="{!c.handleSelect}" />

</aura:component>
JS Controller:
({
handleSelect : function (component, event, helper) {     
    	var stepName = event.getParam("detail").value;
    	component.set("v.picklistField.CSJ_Steps__c",stepName);
        
     	component.find("record").saveRecord($A.getCallback(function(saveResult) {
            if (saveResult.state === "SUCCESS" || saveResult.state === "DRAFT") {
                component.find('notifLib').showToast({
            		"variant": "success",
            		"message": "Record was updated sucessfully",
                    "mode" : "dismissible"
        		});
            } else {
                component.find('notifLib').showToast({
            		"variant": "error",
            		"message": "Unfortunately, there was a problem updating the record.",
                    "mode" : "dismissible"
        		});
            }
        }));
   
    }
})
Does anyone have any ideas? Help is much appriciated!

 
Hi,

I'm trying to recreate the standard Related Record component that we have available in lightning since it's not functioning properly for Person Accounts. The component should display information of the related Account when a user is working on a Case. I thought it would be a good idea to make a lightning:recordViewForm component and diplay all the fields as lightning:outputFields. 

Actually creating the layout shouldnt be a problem. I'm having trouble getting to the AccountId and placing it in the recordId attribute. My code so far:
<aura:component implements="flexipage:availableForAllPageTypes, force:hasRecordId" access="global">

    <lightning:recordViewForm recordId="???" objectApiName="Account">
        <div class="slds-box slds-theme_default">
            <lightning:outputField fieldName="Name" />
            <lightning:outputField fieldName="Phone"/>
            <lightning:outputField fieldName="PersonEmail" />
            <lightning:outputField fieldName="PersonBirthdate" />
        </div>
    </lightning:recordViewForm>
    
</aura:component>
I guess I should use force:recordData somehow but don't know enough about lightning components to get this to work. Help is much appriciated!

Thanks!