3

I'm trying to create a lookup column to a task list, but I only want to display top-level task names in the lookup, not all the subtasks.

Is there any way to do this?

2

The native Lookup field doesn't have filter option. So you have four options.

Option 1

Create another task list (TaskListB) and copy the required items from original task list (TaskListA) to TaskListB. Create a workflow on TaskListA to insert/update the required new items to TaskListB. Now use TaskListB in the lookup field.

Option 2

Use SPServices.SPAutocomplete to implement the autocomplete feature on a textbox based on filtered data from a list. Complete documentation is here. An example code looks like this

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/2014.02/jquery.SPServices-2014.02.min.js"></script>
<script type="text/javascript">
$().SPServices.SPAutocomplete({
    sourceList: "TaskList",
    sourceColumn: "Title",
    columnName: "TitleOnNewOrEditForm",
    CAMLQuery: "<Eq><FieldRef Name='Status'/><Value Type='Text'>Active</Value></Eq>",
    ignoreCase: true,
    numChars: 3,
    slideDownSpeed: 1000,
    debug: true
});
</script>

Option 3

Use SharePoint filtered lookup field from codeplex which allows to select a list view to display filtered data in the lookup.

Option 4

Use a calculated column with a formula to display only top level task names and blank for others. Create a lookup on the calculated column.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.