This SharePoint tutorial, we will disucss, how to fix error The field <field name> of type taxonomyfieldtype cannot be used in the query filter expression. The error comes when we try to filter based on taxonomy field type in SharePoint Online visual studio 2015 workflow.
Recently we were working in a visual studio 2015 workflow for our SharePoint online site. In that workflow, we were trying to filter data from a SharePoint online list. We were filtering based on a taxonomy field type through Rest API by using a httpsend workflow activity. But it gave me an error like below:
“The field <field name> of type TaxonomyFieldType cannot be used in the query filter expression”. The error looks like below:
The field <field name> of type taxonomyfieldtype cannot be used in the query filter expression
We were using the below URL:
https://oursite.sharepoint.com/sites/MyDev/_api/web/lists/getByTitle(‘ourlistname’)/items?$filter=FieldName eq Execution
The field <field name> of type taxonomyfieldtype cannot be used in the query filter expression
We can not filter based on the taxonomy field like above. So we can write like below:
Here we have used 3 variable inside our workflow:
- currentWebUri: This will give the current site URL.
- ourListGuid: This will give our current list guid
- CurrentItemTaxonolyFieldWssId: This will give the WssId of the column which we want to use in the filter condition.
We have to use CAML like below:
currentWebUri + "_api/lists(guid\'" + ourListGuid + "\’)/GetItems([email protected])[email protected]={\"ViewXml\":\"<View%20Scope=\’RecursiveAll\’><RowLimit>1</RowLimit><Query><Where><Eq><FieldRef%20Name=\’FieldName\’%20LookupId=\’True\’/><Value%20Type=\’Integer\’>" + CurrentItemTaxonolyFieldWssId + "</Value></Eq></Where></Query></View>\"}"
If you are using inside a visual studio 2015 workflow using httpsend activitity make sure to use this as a POST request rather than a Get request.
You may like following SharePoint tutorials:
- SharePoint online visual studio workflow issue The ExpressionTranslationBuildTask task failed unexpectedly
- SharePoint Approved and Rejected buttons not appearing in task form in Visual Studio 2015 workflow
- Workflow association form sharepoint not appearing visual studio 2015 while developing workflow for SharePoint online Office 365 site
- Cannot cast LValue expression to type Microsoft.Activities.DynamicValue error in visual studio 2015 workflow
- SharePoint Hosted Add-in: Send Email using visual studio workflow
- Invalid text value. A text field contains invalid data error in visual studio 2015 workflow in SharePoint online
This SharePoint tutorial helps us to solve an error The field <field name> of type TaxonomyFieldType cannot be used in the query filter expression.
Bhawana Rathore is a Microsoft MVP (3 times in Office Apps & Services) and a passionate SharePoint Consultant, having around 10 years of IT experience in the industry, as well as in .Net technologies. She likes to share her technical expertise in EnjoySharePoint.com and SPGuides.com