TransWikia.com

navigate to custom lightning record page in lightning component

Salesforce Asked on December 12, 2021

component.find("navId").navigate({
            type: 'standard__recordPage',
            attributes: {
                recordId: OppId,
                actionName: 'view',
                objectApiName: 'Opportunity'
            }
        }, true);

Above is my code which takes me to standard record but i want to go custom lightning record page which i created "CustomlightRecPage"

How i can navigate

One Answer

Please try following code.

function : openTestComponent(cmp, e, h) {
    var pageReference = {
                        type: 'standard__component',
                        attributes: {
                            "componentName" : "c__CustomlightRecPag"
                        },
                        state: {
                            "c__recordId": cmp.get("v.OppId")
                        }
                    };
     e.preventDefault();
     var navService = cmp.find("navService");
     navService.navigate(pageReference);
     h.delayedRefresh(100);
 }
 
 helper.js
 
 delayedRefresh : function(ms){
        let ms = ms || 100;
        window.setTimeout($A.getCallback(function(){
            $A.get('e.force:refreshView').fire();
        }),ms);
    }

Answered by Rachit on December 12, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP