Tools

WHD Fix Ticket Loop In Merged Tickets

This article describes how to fix the existing ticket loop in the WHD database

First published date

5/7/2020 2:46 PM

Last published date

5/7/2020 2:46 PM

Overview

Previous release versions of WHD (EOL) allows you to create cyclic relations when merging a tickets which results in infinite LOOP. This issue has already been addressed in newer version of WHD however, the existing ticket loops remains in the database and throws the following error:

System has detected loop in merged tickets. Loop is between these tickets [######, ######]. Please contact support for further details at support@solarwinds.com.

Newer version of WHD now detects and prevents users from merging a previously merged ticket:

Product section

Web Help Desk

Cause

Tickets that were previously merged into multiple parent tickets

Resolution

Please refer to the following steps:

1. Execute the following query to list all the tickets that are stuck in infinite loop:
 
# Scripts are provided AS IS without warranty of any kind. SolarWinds further disclaims all warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose.
# The risk arising out of the use or performance of the scripts and documentation stays with you. 
# In no event shall SolarWinds or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the scripts or documentation. 

========================================================================

SELECT F.JOB_TICKET_ID AS FIRST_TICKET_ID,F.MERGED_PARENT_TICKET_ID AS FIRST_TICKET_PARENT_ID,S.JOB_TICKET_ID AS SECOND_TICKET_ID, S.MERGED_PARENT_TICKET_ID AS SECOND_PARENT_ID, HE.ENTRY_TEXT, HE.ENTRY_DATE FROM JOB_TICKET as F JOIN JOB_TICKET as S ON S.MERGED_PARENT_TICKET_ID=F.JOB_TICKET_ID AND F.MERGED_PARENT_TICKET_ID = S.JOB_TICKET_ID JOIN HISTORY_ENTRY AS HE on F.JOB_TICKET_ID = HE.JOB_TICKET_ID WHERE HE.ENTRY_TEXT LIKE 'Merged in%' ORDER BY HE.ENTRY_DATE DESC;



2. Once you identify the proper parent ticket the following query must be executed in order to break the loop behavior:
 
# Scripts are provided AS IS without warranty of any kind. SolarWinds further disclaims all warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose.
# The risk arising out of the use or performance of the scripts and documentation stays with you. 
# In no event shall SolarWinds or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the scripts or documentation. 

========================================================================

UPDATE JOB_TICKET SET MERGED_PARENT_TICKET_ID=NULL WHERE JOB_TICKET_ID=<parentID>;

**Note**The "parentID" (which is also reflects as the Ticket Number) is obtained from the first query.

3. You can run these queries to fix the ticket loop until the first query returns no result.

Optional: If you have a suspected Ticket ID or Ticket Number it can also be examined in database with following query:
 
# Scripts are provided AS IS without warranty of any kind. SolarWinds further disclaims all warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose.
# The risk arising out of the use or performance of the scripts and documentation stays with you. 
# In no event shall SolarWinds or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the scripts or documentation. 

========================================================================

SELECT MERGED_PARENT_TICKET_ID FROM JOB_TICKET WHERE JOB_TICKET_ID = <TICKETID>;

This query will return the parent ticket ID. Which is used to run query again until you hit NULL value or the IDs start to repeat them selves.
If the IDs start to repeat the ticket is in loop hierarchy.

Disclaimer: Scripts are not supported under any SolarWinds support program or service. Scripts are provided AS IS without warranty of any kind. SolarWinds further disclaims all warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The risk arising out of the use or performance of the scripts and documentation stays with you. In no event shall SolarWinds or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the scripts or documentation.