cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
kaylee_wissink
Nintex Newbie

Default Value for List Lookup

I have a SharePoint List, Swimlanes, that has 3 columns: Title, Person, Product Group.

Example:

TitlePersonProduct Group
Title APerson AProduct Group 1
Title APerson BProduct Group 2
Title BPerson CProduct Group 1

I have a Nintex Form that has 5 different list lookup fields, all which connect to the Swimlanes List. Each Lookup field is filtered on the Title column in the swimlanes list. For each lookup field, the user needs to select a user or users (person column) that should be added. Multiple values can be selected.

I would like to set a default value for each List lookup field based on Product Group. For example, if I am filling out a form and select Product Group 1 for the product group field, for Lookup field A (Title A), I would want the corresponding user in the list that matches Title A and Product Group 1 to be the default value. In this example, the default value would be Person A.

Any ideas how I would do that?

Tags (2)
Reply
2 Replies
fhunth
Nintex Newbie

Re: Default Value for List Lookup

Currently there's not a Nintex feature  to do this.

You could do it with some scripting.

Here is a sample to set the first time default for a control named ddlswim

NWF$(document).ready(function() {

NWF$("#" + ddlswim).val('1');

} );

0 Kudos
Reply
Automation Master
Automation Master

Re: Default Value for List Lookup

Good recommendation Fernando Hunth​! To take this a step further, you could also bind to the change JavaScript event and then dynamically set the default value(s) based on the values selected in your Product Group. Here's a quick sample on how that would work:

NWF$(document).ready(function () {

    Data.setDefaults('changingChoiceControl1', 'impactedChoiceControl1', 'default 01');

    Data.setDefaults('changingChoiceControl2', 'impactedChoiceControl2', 'default 02');

    Data.setDefaults('changingChoiceControl3', 'impactedChoiceControl3', 'default 03');

});

var Data = {

    setDefaults: function (choiceControlChanging, choiceControlImpacted, defaultValue) {

        var imChanging = NWF$('.' + choiceControlChanging);

        // When the choiceControlChanging field changes, the following function will execute

        // dynamically changing the default value of the control

        NWF$(imChanging).change(function () {

            var imImpacted = NWF$('.' + choiceControlImpacted);

            imImpacted.val(defaultValue);

        });

    },

}

Keep in mind, I've fetches these variables using their CSS class, but the same could be done using their JavaScript Client ID variables. Good luck!

Reply