0

I'm working on a lightning component under quick action. I'm trying to navigate the user to the edit page but it's navigating to the standard view page.

 var navService = component.find("navService");
                    var pageReference =
                        {
                            type: 'standard__recordPage',         
                            "attributes": {              
                            "recordId": storeResponse,
                            "actionName": 'edit',               
                            "objectApiName":"Opportunity"              
                        }        
                    };
                    component.set("v.pageReference", pageReference);  
                    var pageReference = component.get("v.pageReference");
                    navService.navigate(pageReference);

Could you help me to achieve this?

1

Any reason why are we setting pageReference back to a variable when we already have a local variable for the same. May be your pageReference is missing.

This works very well.

clickEdit: function (component , event, helper) {
    event.preventDefault(); // Preventing any default behaviour
    const navService = component.find("navService");
    const pageReference =
        {
            type: 'standard__recordPage',
            "attributes": {
                "recordId": component.get('v.recordId'), // Pass the record Id
                "actionName": 'edit',
                "objectApiName":"Opportunity"
            }
        };
    navService.navigate(pageReference);
}
1
  • It works like a charm!!
    – Pavan tej
    Nov 29 '21 at 12:59

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.