0

I have one requirement where i need to redirect to list view after saving the opportunity record. Is here anyway we can do it.

1 Answer 1

1

You can redirect to List view by specifying listviewId in force:navigateToList. Please see the example below.

gotoList : function (component, event, helper) {
    var action = component.get("c.getListViews");
    action.setCallback(this, function(response){
        var state = response.getState();
        if (state === "SUCCESS") {
            var listviews = response.getReturnValue();
            var navEvent = $A.get("e.force:navigateToList");
            navEvent.setParams({
                "listViewId": listviews.Id,
                "listViewName": null,
                "scope": "Opportunity"
            });
            navEvent.fire();
        }
    });
    $A.enqueueAction(action);
}

Controller

@AuraEnabled
public static List<ListView> getListViews() {
    List<ListView> listviews = 
        [SELECT Id, Name FROM ListView WHERE SobjectType = 'Opportunity'];

    // Perform isAccessible() check here
    return listviews;
}

For more details click here

Not the answer you're looking for? Browse other questions tagged .