I am working on a standalone search engine that will return all tickets and history notes, where the search word(s) are in the ticket or history notes.
I have the ticket portion working, but I am missing tickets where the word(s) are not in the TICKETS but are in the HISTORYNOTE description.
So the question is there a way to add a search with the tickets that will also search the historynotes and return the ticket result? I have a section that will then go into the historynotes and return all the historynotes for the given ticket.
If not what route would you suggest? I am trying to use the API first before going down the ODBC/linkedserver route.
Also trying to create the search to search for multiple words in any order within the tables (IE: if I enter "Jump new" in search it will look for tickets that contain both jump AND new in either description, resolution, or notes. So it could return "Sally has a new jumprope" or "John jumped the new truck")
Again I am stuck at pulling tickets where the result is in the history notes only and the multiple results
Any direction would be appreciated
I have the ticket portion working, but I am missing tickets where the word(s) are not in the TICKETS but are in the HISTORYNOTE description.
So the question is there a way to add a search with the tickets that will also search the historynotes and return the ticket result? I have a section that will then go into the historynotes and return all the historynotes for the given ticket.
If not what route would you suggest? I am trying to use the API first before going down the ODBC/linkedserver route.
Also trying to create the search to search for multiple words in any order within the tables (IE: if I enter "Jump new" in search it will look for tickets that contain both jump AND new in either description, resolution, or notes. So it could return "Sally has a new jumprope" or "John jumped the new truck")
Dim ticketSearch As New CommitCRM.ObjectQuery(Of CommitCRM.Ticket)(LinkEnum.linkOR)
Dim tickets As New List(Of CommitCRM.Ticket)
For Each n In SearchString.Split(New Char() {" "c})
ticketSearch.AddCriteria(Ticket.Fields.Description , OperatorEnum.opLike, "%" & n & "%")
ticketSearch.AddCriteria(Ticket.Fields.Resolution, OperatorEnum.opLike, "%" & n & "%")
ticketSearch.AddCriteria(Ticket.Fields.Notes, OperatorEnum.opLike, "%" & n & "%")
Next
For Each tic In ticketSearch.FetchObjects()
Response.BufferOutput = True
tickets.Add(tic)
' Get associated HistoryNotes
Dim HistorySearch As New CommitCRM.ObjectQuery(Of HistoryNote)(LinkEnum.linkOR)
HistorySearch.AddCriteria(HistoryNote.Fields.RelLi nkREC_ID, CommitCRM.OperatorEnum.opEqual, tic.TicketREC_ID)
'HistorySearch.AddSortExpression(HistoryNote.Field s.Date, SortDirectionEnum.sortDESC)
Dim history As New List(Of CommitCRM.HistoryNote)
For Each hNote In HistorySearch.FetchObjects()
history.Add(hNote)
Next
histNotes.DataSource = history
histNotes.DataBind()
Next
rptTicket.DataSource = tickets
rptTicket.DataBind()
Dim tickets As New List(Of CommitCRM.Ticket)
For Each n In SearchString.Split(New Char() {" "c})
ticketSearch.AddCriteria(Ticket.Fields.Description , OperatorEnum.opLike, "%" & n & "%")
ticketSearch.AddCriteria(Ticket.Fields.Resolution, OperatorEnum.opLike, "%" & n & "%")
ticketSearch.AddCriteria(Ticket.Fields.Notes, OperatorEnum.opLike, "%" & n & "%")
Next
For Each tic In ticketSearch.FetchObjects()
Response.BufferOutput = True
tickets.Add(tic)
' Get associated HistoryNotes
Dim HistorySearch As New CommitCRM.ObjectQuery(Of HistoryNote)(LinkEnum.linkOR)
HistorySearch.AddCriteria(HistoryNote.Fields.RelLi nkREC_ID, CommitCRM.OperatorEnum.opEqual, tic.TicketREC_ID)
'HistorySearch.AddSortExpression(HistoryNote.Field s.Date, SortDirectionEnum.sortDESC)
Dim history As New List(Of CommitCRM.HistoryNote)
For Each hNote In HistorySearch.FetchObjects()
history.Add(hNote)
Next
histNotes.DataSource = history
histNotes.DataBind()
Next
rptTicket.DataSource = tickets
rptTicket.DataBind()
Any direction would be appreciated
Comment