I am trying to select records from list view custom button. I want to pass the selected record ids in the paramaters.
I tried the below and its not working for me.
/lightning/cmp/c__TestURLfor?c__listofAccounts={!GETRECORDIDS($ObjectType.Account)}
I am passing the selected record ids to the listofacccounts attribute in the lightning component. Am I missing anything here.
Here is my lightning component and the controller :
Cmp:
<aura:component implements="lightning:isUrlAddressable">
> <aura:attribute name="listofAccounts" type="List" />
> <aura:handler name="init" value="{!this}" action="{!c.onPageReferenceChange}"/>
> {!v.listofAccounts[0]}.
</aura:component>
Controller :
({
onPageReferenceChange: function(cmp, evt, helper) {
var pageRef = cmp.get("v.pageReference");
var listofAccounts = myPageRef.state.c__listofAccounts;
cmp.set("v.listofAccounts", listofAccounts);
console.log('listofAccounts',listofAccounts);
}
})
I get this error whenever I click the List view custom URL button
"Invalid request, post must use JSON"
pagereference
andnavigationservice
firing?