Hey guys, today in this post we are going to learn about How to navigation to create Account record and list view in LWC.
Final Output β
Other related post that would you like to learn in Salesforce
Create HTML Page β
Step 1:- Create HTML Page : navigationPageLwc.html
navigationPageLwc.html [HTML PAGE]
<template>
<lightning-card title="Navigate to create Account Record Page">
<!-- Navigation to create Account record and List View -->
<div class="slds-m-around_medium">
<TABLE class="slds-table slds-table_bordered slds-table_col-bordered">
<tr>
<td STYLE="width:50%;">Navigation TO CREATE Account record</td>
<td STYLE="width:50%;"><lightning-button variant="brand" label="Navigation to Account" onclick={actionToNavigateAccount}></lightning-button></td>
</tr>
<tr>
<td STYLE="width:50%;">Navigation TO Recent List VIEW OF Account</td>
<td STYLE="width:50%;"><lightning-button variant="brand" label="Navigation to list view of Account" onclick={actionToListViewAccount}></lightning-button></td>
</tr>
</table>
</div>
</lightning-card>
</template>
Create navigationPageLwc.js β
Step 2:- Create JavaScript Page : navigationPageLwc.js
navigationPageLwc.js [JavaScript Page]
import { LightningElement, api } FROM 'lwc';
import {NavigationMixin} FROM 'lightning/navigation';
export DEFAULT class NavigationPageLwc extends NavigationMixin(LightningElement) {
@api recordId='0015i000017iZ5sAAE';
///Navigation TO CREATE Account record AND List VIEW
actionToNavigateAccount(){
this[NavigationMixin.Navigate]({
TYPE:'standard__objectPage',
attributes:{
objectApiName:'Account',
actionName:'new'
}
});
}
actionToListViewAccount(){
this[NavigationMixin.Navigate]({
TYPE:'standard__objectPage',
attributes:{
objectApiName:'Account',
actionName:'list'
},
filterName:'Recent'
});
}
}
What is record view form in LWC?
Use the lightning-record-view-form component to create a form that displays Salesforce record data for specified fields associated with that record. The fields are rendered with their labels and current values as read-only. You can customize the form layout or provide custom rendering of record data.
How do I add items to a list view?
If the list is not sorted, you can use the Insert method to insert an item into the ListView at a specific position. To add a set of items to the control in a single operation, use the AddRange method.
How do I create a list view for a profile?
From Setup, in the Quick Find box, enter Profiles , and then select Profiles. In the Profiles page, click Create New View, or select a view and click Edit. Enter the view name. Under Specify Filter Criteria, specify the conditions that the list items must match, such as Modify All Data equals True.
Related Topics | You May Also Like
Our Free Courses β
π Get Free Course β
![]() π Salesforce Administrators π Salesforce Lightning Flow Builder π Salesforce Record Trigger Flow Builder |
π Get Free Course β
![]() π Aura Lightning Framework π Lightning Web Component (LWC) π Rest APIs Integration |