Pass Id to Step 2 in Wizard

edited March 2, 2017 in Questions
Using the Step Wizard:
I have a list of Lenders in Step 1, with a checkbox need to each of them.
Depending on which Lender is checked, how can I pass the Id (of the Lender) to Step 2 which contains Plans, as I wish to filter Step 2 the Lender selected in Step 1.

I'm not sure how to pass the Id of the selected Lender in Step 1 to Step 2, then filter the table.


  • edited December 18, 2014
    Try something like this as a row action on your lenders table in step 1:
    var params = arguments[0],   $ = skuid.$;
    var model = params.model;
    var row = params.item.row;
    // get a reference to the row the user clicked
    var Id = row.Id;
    // get the Lender Plans Model by it's name
    var lenderPlansModel = skuid.$M('LenderPlans');
    // get the condition on the model by it's name, (this condition should be filterable default off)
    var lenderIdCondition = lenderPlansModel.getConditionByName('NameOfYourCondition');
    // set the lender plan model to only show for the selected rows lender
    lenderPlansModel.setCondition(lenderIdCondition, Id);
    // get a reference to the wizard step
    var wizard = $('.nx-wizard').data('object'); 
    var currentStep = wizard.steps[wizard.currentstep];
    // requery the Lender Plans model with the condition active 
    //navigate to step 2
  • edited October 22, 2014
    Hi Moshe, thanks a lot for the reply, I tried the above but it was unsuccessful, I had already written something similar for the first step below which works:

    //get models and conditions
        var QuoteWizardStep2Model = skuid.model.getModel('QuoteWizardStep2');
        var step2LenderIdCondition = QuoteWizardStep2Model.getConditionByName('Step2LenderId');
        //Set the QuoteWizardStep2 model's condition to contain the idsOfRowsThatAreChecked, and refresh the model
        QuoteWizardStep2Model.setCondition(step2LenderIdCondition, idsOfRowsThatAreChecked[0], true);
        //Navigate to Step 2
        var wizard = $('.nx-wizard').data('object');
        var currentStep = wizard.steps[wizard.currentstep];

    The Snippet I have for Step 2, which needs to take the LenderId and LenderPlanId and these details need to populate the fields in Step 3 which is creating a New Quote doesn't work, my code is below if you have any suggestions, thanks:

    var params = arguments[0],
        $ = skuid.$;

    //Declare variable for the Field to retrieve values from   
    var CHECKBOX_FIELD = "Select_Item__c";
    var LENDER_FIELD = "Lender__c";
    var idsOfRowsThatAreChecked = [];
    var idsOfLendersThatAreChecked = [];

    //Get Model
    var QuoteWizardStep2Model = skuid.model.getModel('QuoteWizardStep2');

    //Loop through all rows and grab the Id's of the ones checked as Received
       if (QuoteWizardStep2Model.getFieldValue(row,CHECKBOX_FIELD)===true){

    if (idsOfRowsThatAreChecked.length > 1){
        alert('You can only Select one Lender');
        //get models and conditions
        var QuoteWizardStep3Model = skuid.model.getModel('QuoteWizardStep3');
        //var step3LenderIdCondition = QuoteWizardStep3Model.getConditionByName('Step3LenderId');
        var step3LenderPlanIdCondition = QuoteWizardStep3Model.getConditionByName('Step3LenderPlanId');
        //Set the QuoteWizardStep3 model's condition to contain the Lender & Lender Plan, and refresh the model
        //QuoteWizardStep3Model.setCondition(step3LenderIdCondition, idsOfLendersThatAreChecked[0], true);
        QuoteWizardStep3Model.setCondition(step3LenderPlanIdCondition, idsOfRowsThatAreChecked[0], true);
        //Navigate to Step 2
        var wizard = $('.nx-wizard').data('object');
        var currentStep = wizard.steps[wizard.currentstep];

  • edited October 24, 2014
    Hi Moshe is there a way to pass a param value from one step to another in the Step Wizard. I don't think you can use URL Params?
  • Emily DavisEmily Davis ✭✭✭✭
    edited March 2, 2017
    Hi, Eddie,

    For your situation, I don't think you will be able to pass it just using the actions framework. With the actions framework, you can pass values using global variables, such as {{$}} (referring to the first row in the model), but this would require knowing which row's Id to pass ahead of time. I think you're going to have to still use JS. I should point out that the field picker for a wizard button is nonsensical since the wizard is not attached to a specific model... I think we're planning to fix that!


    Does that answer your initial question?

    As for why the code is not working, you said that the first section of code is working? So, in the first part, are you creating a new row or bringing in existing data that follows the condition you are setting? Also, what kind of error are you getting for the second part?
  • Emily DavisEmily Davis ✭✭✭✭
    edited March 2, 2017
    Actually, I just saw your other post. Even if your QuoteWizardStep3Model brings in a single, new row on page load, whenever you call updateData() (querying the model), you will bring in existing data that follows your newly set condition (up to the Max # of Records). So, even if your model has a max # of records equal to 1, and you select "Create default row if Model has none" and deselect "Load Model data on page load," whenever you query the model again, your new row will be replaced with a single row from your existing data that obeys the model conditions (whereas you want to create a new row obeying the model conditions). Does that make sense?

    So, rather than calling update data, your answer would be:
    1) If needed, abandon the current row:
    if ( > 0) {  $.each(, function(i, row){   QuoteWizardStep3Model.abandonRow(row);  }); }  
    2) Create your new row
    And then proceed with navigating to the next step. I THINK that should work. Give it a try and let me know.
  • Emily DavisEmily Davis ✭✭✭✭
    edited December 21, 2016
    Note the warnings for abandonRow() in our documentation ... you may want to use removeRowById() instead.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!