Limit Results in a Drop Down List

Hello,

Is there a way to limit the results that are shown in a drop down list based on another field?

Ex.
Field A is a drop down list of companies
Field B is User Roles and the User Roles are labeled such as - Claims - Company A

If Field A = Company A then I would want Field B to only show user roles that have Company A in the name.

Is anything like this possible?

Hello @Nazman1126,

Yes, I think Cascading dropdowns is what you are looking for.

Please find the setup instructions in our documentation here.

@mnikitina I am not sure how to do this. SharePoint online does not have a cascading dropdown field and the images in the document you sent me do not match what I currently see in PlumSail Forms.

@Nazman1126,

It doesn't, but it has lookup fields and you can create cascading dropdowns from two lookup fields using the code.

First, you need to create two lists:

  • list of companies;
  • list of user roles with the lookup field that points to the companies list.

Second, you need to create two lookup fields in the main list:

  • one point to the list of companies
  • second to the list with user roles.

After that, you can filter user roles by the company name using the code from the article:

function filterProducts(category) {
    var categoryId = category && category.LookupId || category || null;
    fd.field('Product').filter = 'Category/Id eq ' + categoryId;
    fd.field('Product').refresh();
}

fd.spRendered(function() {
    fd.field('Product').ready().then(function() {
        //filter Products when Category changes
        fd.field('Category').$on('change', function(value){
            filterProducts(value);
            fd.field('Product').value = null;
        });

        //filter Products when form opens
        fd.field('Category').ready().then(function(field) {
            filterProducts(field.value);
        });
    });
});

@mnikitina,

After reading your post I did more research on how to create a look up field.

For me to be able to use a look up field. For me to get it to do what I want it to do I need a choice field and choice fields are not supported when trying to create look up fields. There is an image below directly from Microsoft that states what is supported and what is not.

Thank you for your help with this.

@Nazman1126,

That is correct, you can't select the choice field as the source for the lookup field.

You can store companies and user roles in single-line text fields, in separate SharePoint lists, and set up its dependence. Thus, that will be easier to administer data and easier to create cascading dropdowns.

Another option is to populate common dropdowns with options dynamically, and then pass selected values to the SharePoint field. Please see the example here. Note, that this option is less universal and stable.