function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
VSK98VSK98 

This page isn't available in Salesforce Lightning Experience or mobile app.G

Hello All,

Getting the error when the user clicks on the list view button on Account....

I need to pass  selected records from javascript button to lightning component. So i have created one List View Button.

And also i have created the VF Page / Apex class...below is snippet code
<apex:page standardController="Account" recordSetVar="accs" extensions="VFC_ProcessAccRecords" action="{!redirectToLC}"  lightningStylesheets="true"/>
 
public class VFC_ProcessAccRecords {
      
      public List<Account> selAccLst;
      public String accIds;

      // Constructor
      public VFC_ProcessAccRecords(ApexPages.StandardSetController cntlr){
           selAccLst = cntlr.getSelected(); //get selected records from account list view
           accIds = '';  
           for(Account acc : selAccLst){
               accIds += acc.Id + ','; //build list of ids string concatenated with comma                         
            }
           accIds = accIds.removeEnd(','); 
      } 

      public PageReference redirectToLC(){
      
            String returnUrl = '/lightning/cmp/c__Custom_List_View_Process?c__listofAccounts='+accIds;
            PageReference pgReturnPage = new PageReference(returnUrl);
            pgReturnPage.setRedirect(true);
            return pgReturnPage;
       
          
      }

  }

And also i have created the lightning component

Lightning Component:
 
<aura:component implements="lightning:isUrlAddressable" access="global">
    <aura:attribute name="listofAccounts" type="List" />
    <aura:handler name="init" value="{!this}" action="{!c.onPageReferenceChange}"/>
    <lightning:card title="Account List">
        <aura:iteration items="{!v.listofAccounts}" var="item">
            <p class="slds-p-horizontal_small"> Account Id {!item} </p>
        </aura:iteration>       
    </lightning:card>     
</aura:component>
 
({
    onPageReferenceChange: function(cmp, evt, helper) {
        alert('alert');
        var myPageRef = cmp.get("v.pageReference");
        var accs = myPageRef.state.c__listofAccounts;
        alert(accs.length);
        console.log('listofAccounts',JSON.stringify(accs));
      //  cmp.set("v.listofAccounts",accs);
        //split the account ids by comma and continue logic
    }
})

the values are passing but getting the error "This page isn't available in Salesforce Lightning Experience or mobile app." 

Regards,
VSK98
MagulanDuraipandianMagulanDuraipandian
Edit the VF page and make sure "Available for Lightning Experience, Lightning Communities, and the mobile app" is enabled.
Steps - http://www.infallibletechie.com/2018/06/new-button-is-not-appearing-in.html
VSK98VSK98
Hi MagulanDuraipandian,

I have already enabled the lightning experience checkbox but no luck.............

Regards,
VSK98
MagulanDuraipandianMagulanDuraipandian
Try this way
1. Use Lightning Component and avoid VF.
2. Call the apex method using init event from Lightning Component.

There is no standard way of navigating from vf to Lightning - https://developer.salesforce.com/forums/?id=9060G000000I22IQAS