I am working on SPFx Project and using PnPjs search. My requirement is to search for pending workflow task for that I have created result source at site collection level. Builder query as below
{searchTerms} ContentTypeId:0x0108* Path:{SiteCollection.URL} WorkflowOutcomeOWSTEXT:Pending
Now I am using SPFx to retrieve data. I cannot get related item of the task or related item id for the original item. Other than that I get all data. Let me know I am doing wrong or there is some issue pnpjs
My code as below (SPFx v2.0.6 and SharePoint Online/2019)
const getContentTypeData = async (rowLimit: number, sourceId: string, querytext: string, selectedProperties: string[]) => {
const appSearchSettings: ISearchQuery = {
RowLimit: rowLimit,
EnableInterleaving: true,
SourceId: sourceId,
TrimDuplicates: false,
Querytext: querytext,
SelectProperties: selectedProperties
}
const searchResults: SearchResults = await sp.search(appSearchSettings)
return searchResults
}
const selectedProperties = ['ListItemID', 'Path', 'Title', 'HitHighlightedSummary', 'LastModifiedTime', 'ParentLink', 'RelatedItems']
const rowLimit = 10
let queryText = AssignedTo:"${displayName}"
// Passing current user displayName
getContentTypeData(rowLimit, searchSourceId.PendingTask, queryText, selectedProperties)
.then((r: SearchResults) => {
setPendingTask({ totalRows: r.TotalRows, primarySearchResults: r.PrimarySearchResults })
})
.catch(console.warn)
Hi @Milind Saraswala ,
This issue has idled for a long time, If the above info is helpful to this question, it would be appreciated if you can mark it as an answer so that others who stuck in similar issues could get answered quickly. And if you want to receive the related email notification for this thread, please follow the steps in our documentation to enable e-mail notifications
Thanks
Baker Kong
Sorry I just show your reply. I am really sorry for that. I will try this and let you know.
Hi @Milind Saraswala ,
Does this issue go on the right way? Please feel free to talk with us if you have other questions.
Thanks
Baker Kong
In my case i cannot find RelatedItems in Managed Properties and ows_RelatedItems in crawled properties
Hi, is it normal or something happen to my SharePoint can we solve this issue ?
Sorry, just come back from holiday.
Please populate some data into the target column then start a full crawl, after that ows_RelatedItems should appear in crawled properties.
Thanks
Baker Kong
Sign in to comment