I'm currently modifying a Lightning Component that someone else created. As such, I'm trying to get the hang of how to work with Aura as I haven't done it before - only Apex and a bit of Visualforce.

Essentially, I have an initial screen which prompts record type selection. In the controller for this screen I have the 'redirect' function, which (after some other code), does the following:

var splitArray = recordTypeID.split("/");
//recordTypeID is the ID of the record type the user selects.
var navService = component.find("navService");
var pageReference = {
    type: 'standard__component',
    attributes: {
        componentName: 'c__PersonWizard'


This will redirect the user to the PersonWizard component. The first page should display a table of Contacts and provides a search box at the top to search for a Contact. At the moment, this table is not filtered based on anything. However, I want to filter it to only Contacts with the record type chosen by the user.

The PersonWizard uses a controller class (Javascript) - whose doInit function runs a helper method called 'getDataTableData' (this is the method that gets all the Contact data to display in the initial table of Contacts shown to the user. The getDataTable function includes this code:

var recordTypeIdVar = component.get("v.pageReference.state.c__recordTypeID");
var action = component.get("c.getDataTableDetails");
console.log('Record Type ID Passed Through to getTableDataDetails(Apex): '+recordTypeIdVar);

//... some more code that's not relevant to the issue...


Now, when I check the console output, I can see that the 'log' command in line 3 is logging the recordTypeId value correctly:

"Record Type ID Passed Through to getTableDataDetails(Apex): 0126F000000iWXvQAM"

The Apex class (getDataTableDetails) includes the 'recordTypeId' String parameter as one of its arguments, as well as objectName, fieldSetName, pageNumber and pageSize. I have included a System.debug() line at the start of the method which prints the value of the recordTypeId argument. Here is the problem: that argument is null when I run the wizard:

Record Type ID Passed Through to getDataTableDetails: null

So it seems that the Javascript helper class is able to obtain the recordTypeId value from the Pagereference. However, when it tries to set that value as one of the parameters for the action (running the Apex function), it doesn't pass through anything. Can anyone help me as to why this might be happening? Is my syntax on action.setParams() correct?

Thanks a lot in advance.

  • What's the Apex being called, specifically? Did you check to make sure the parameter names are case sensitive correct to what's passed in through JS?
    – sfdcfox
    Commented Jun 26, 2021 at 4:24
  • It is a method called getDataTableDetails. Here's the header: public static DataTableDetails getDataTableDetails(String objectName,String fieldSetName, String recordTypeId, Integer pageNumber,Integer pageSize) Double checked the parameter name and it's exactly the same: recordTypeId
    – callum202
    Commented Jun 26, 2021 at 4:43
  • 1
    Can you change the pageNumber and pageSize params to a String? I have had issues passing integers before. Also, try passing in a single object, which will evaluate to a map in Apex. Last thing - pass only the recordTypeId just to test that it's not something else. Commented Jun 26, 2021 at 6:49
  • Check this link- I also faced this problem where setParams is correct and the parameter case also matches but still the same issue. Both the solution worked for me at different times. salesforce.stackexchange.com/questions/169952/… Commented Jun 26, 2021 at 7:16

2 Answers 2


So clearing my cookies solved this issue. Thanks everyone for the help.


You have an extra comma at the end of your json in the setParams. Remove the comma after pageSize:pageSize


You must log in to answer this question.

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