QueryFactory provides a powerful mechanism to dynamically control picker results by generating queries at runtime using values from other columns. This enables cascading selections, reduces user error, and ensures that only valid, context-appropriate work items can be linked.
Example from the sample:
1. User selects a Sequence of Events
2. The Hazardous Situation picker automatically filters to show only situations linked to that sequence
3. No manual filtering needed - users see only valid choices
TABLE OF CONTENTS
- No headings available. Use Paragraph Format to add one.
Query options
Static query vs Dynamic queryFactory
The typeProperties object supports two ways to filter the picker:
Static query
Same query for all rows - does not change based on row data:
"typeProperties": {
"linkRole": "assessedHarm",
"linkTypes": "harm",
"document": "Libraries/harms",
"query": "status:approved"
}
Every row shows the same list: all approved harms from the library.
Dynamic queryFactory
Query generated per-row based on other column values:
"typeProperties": {
"linkRole": "assessedHazardousSituation",
"linkTypes": "hazardousSituation",
"queryFactory": "situationsQuery"
}
Each row shows different items depending on what's selected in parent columns.
Using Both Together
queryFactory extends (not replaces) the static query. When both are specified, they are combined:
"typeProperties": {
"linkRole": "assessedHazardousSituation",
"linkTypes": "hazardousSituation",
"document": "Libraries/hazardSituations",
"query": "status:approved",
"queryFactory": "situationsQuery"
}
Result: Picker shows items matching both status:approved (static) AND the dynamic query from situationsQuery.
Comparison
| Aspect | query | queryFactory |
| Query changes per row | No | Yes |
| Uses other column values | No | Yes |
| Use case | Base filter (e.g., "approved items only") | Additional row-specific filtering |
| Combined behavior | Base criteria | Extends the base query |
How to Use
1. Define the QueryFactory
"queryFactories": {
"situationsQuery": "function(info){return 'linkedWorkItems:'+info.item['assessedSequence']}"
}
The function receives info with:
- info.item - Current row's field values (use column id to reference)
2. Reference in itemLink Column
{
"header": "Hazardous Situation",
"type": "itemLink",
"id": "assessedHazardousSituation",
"bindings": "assessedHazardousSituation.description",
"typeProperties": {
"linkRole": "assessedHazardousSituation",
"linkTypes": "hazardousSituation",
"query": "status:approved",
"queryFactory": "situationsQuery"
}
}
Common Query Patterns
| Query | Purpose |
| 'linkedWorkItems:'+info.item['parentColumn'] | Items linked to parent selection |
| 'status:approved AND type:'+info.item['typeField'] | Filter by status + row value |
| getProdFamilyQuery(info) | Call external function (defined in top panel) |
Example: Cascading Risk Assessment
"queryFactories": {
"situationsQuery": "function(info){return 'linkedWorkItems:'+info.item['assessedSequence']}"
}
When user picks assessedSequence = "SOE-123", the Hazardous Situation picker runs query linkedWorkItems:SOE-123 combined with any static query, showing only approved situations linked to that sequence of events.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article