SOLVED

PnP Modern Search - Use Users Department in Query

%3CLINGO-SUB%20id%3D%22lingo-sub-3277310%22%20slang%3D%22en-US%22%3EPnP%20Modern%20Search%20-%20Use%20Users%20Department%20in%20Query%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3277310%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20idea%20is%20to%20create%20a%20view%20of%20a%20list%20via%20search%20which%20will%20only%20shows%20results%20where%20Department%20column%20in%20list%20%3D%20current%20user's%20Department.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20something%20this%20possible%3F%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWas%20thinking%20something%20like%20classic%20Change%20query%20worked...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%7Bsearchbox%7D%20Department%3D%7BUser.Department%7D%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3277310%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESearch%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3278347%22%20slang%3D%22en-US%22%3ERe%3A%20PnP%20Modern%20Search%20-%20Use%20Users%20Department%20in%20Query%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3278347%22%20slang%3D%22en-US%22%3ELooks%20like%20the%20above%20tokens%20do%20work%20in%20PnP%20Modern%20Search%20-%20I%20just%20need%20modify%20it%20a%20bit%2C%20using%20the%20debug%20view%20allowed%20me%20to%20nail%20it%20down%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fmicrosoft-search.github.io%2Fpnp-modern-search%2Fusage%2Fsearch-results%2Ftokens%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fmicrosoft-search.github.io%2Fpnp-modern-search%2Fusage%2Fsearch-results%2Ftokens%2F%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%7Bsearchbox%7D%20Department%3D%22%7BUser.Department%7D%22%3CBR%20%2F%3E%3CBR%20%2F%3Ethe%20above%20works%20now%20with%20the%20%22%20%22%20in%20place%3C%2FLINGO-BODY%3E
Regular Contributor

The idea is to create a view of a list via search which will only shows results where Department column in list = current user's Department.

 

Is something this possible??

 

Was thinking something like classic Change query worked...

 

{searchbox} Department={User.Department}

1 Reply
best response confirmed by Warwick Ward (Regular Contributor)
Solution
Looks like the above tokens do work in PnP Modern Search - I just need modify it a bit, using the debug view allowed me to nail it down

https://microsoft-search.github.io/pnp-modern-search/usage/search-results/tokens/

{searchbox} Department="{User.Department}"

the above works now with the " " in place