Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #307: filter out saved values from the allowed values list #315

7 changes: 6 additions & 1 deletion src/getSuggestedValues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,10 @@ export async function getSuggestedValues(): Promise<string[]> {
}
// if the values input were not specified as an input, get the suggested values for the field.
const service = await WorkItemFormService.getService();
return await service.getAllowedFieldValues(VSS.getConfiguration().witInputs.FieldName) as string[];
const allowedValues = await service.getAllowedFieldValues(VSS.getConfiguration().witInputs.FieldName) as string[];

// The getAllowedFieldValues API now returns both predefined and user-saved values,
// which are stored as a semicolon-separated string in case multiple options are selected.
// Filter out user-saved values from the allowed values list to prevent them from showing up as separate options.
return allowedValues.filter((value) => value.indexOf(";") === -1);
}