Filter dropdown in List or Library control


I'm setting up a project planning system. The Project list has two sub-lists, Resource and Activity.

I've successfully created the form for these, so the information can be entered and edited. Both sub-lists are List or Library controls on the main Project form.

The Resource child list has a field for which activity it is relevant to. (Resource Name, Stage, Activity, lookup to parent ProjectID)
The Activity list has just Activity Name, Stage, Status, lookup to parent ProjectID.

I have created a lookup from the Resource list to the Activity list, but it shows all activities across all projects.

How can I filter the Resource sub-list activity lookup dropdown to only show activities attached to the Project (ProjectID)?


Hello @Nick.Jones,

Not sure I fully understood your request.

Resource list should be filtered by Project and Activity, or by the Project only?

Hi @mnikitina ,
Activity and Resource are child lists of the main Project list, linked by Project ID.

The Activity field in the Resource child list is a lookup, pointing to the Activity child list (Title).

At the moment, the dropdown shows all activities on all projects, and I'd like to restrict it to showing just the activities linked to the project being updated.

So, at the moment, if I have three activities on Project 1, two on Project 2, four on Project 3, and then create a new Resource on Project 1 and click the Activity field, it lists all nine activities on Project 1, Project 2, Project 3, etc, rather than just the three activities on Project 1.

I'd like the Activity lookup on the Resource child list to be filtered by the project (main list) that is being viewed.

I hope that explains it a bit better?



Thank you for the explanation. I hope I understood you correctly.

So you want to filter the Activity lookup field in List or Library control that is edited inline by the parent item ID, am I right?

If so, you can use this code to filter lookup field in the List or Library control:

//make sure that the fields/columns internal names are valid
    fd.control('SPDataTable1').$on('edit', function(editData) {
       //fd.itemId - the ID of the parent item
        editData.field('Activity').filter = "Project/Id eq '" + fd.itemId + "'";
        editData.field('Activity').useCustomFilterOnly = true;

You can find more examples and detailed instructions on how to manipulate fields in inline mode in our documentation here.

1 Like