I have a ticket rule designed to link a series of tickets as parents and children.  The tickets are created by e-mails (which is why I am not using a process).

The tickets are created with a linking value in the CUSTOM_FIELD_VALUE14

The ticket rule is designed to look for tickets where the IS_PARENT flag = 0 and compare it to tickets where the IS_PARENT flag = 1, linked on the CUSTOM_FIELD_VALUE14 field.  If there is a match, the PARENTID field of the "should be children" is to be updated with the ID for the "should be parent".

When I run it as "Run now" from within the ticket rule, it works properly (returns the correct records with the correct ID numbers updated)

When I run it as "On Save", the select returns the values I want, but the update

For example  desired Parent ID = 35054 and the desired Child ticket is 35056.  When I run it manually, it updates the "ParentID" field of 35056 with the value 35054, but when it is ran on As Save, it updates the ParentID field of 35056 with its own ID 35056.

This is the output of the select statement

User Termination - Assign Child Tickets

New Rule

#

Id

Parent Id

Parentkaceid

1

35056

0

35054


I believe that when the rule is run as an "on Save" there is something else appended to the end of the SQL statement, but I don't know exactly what, or how that would impact the updates.


Thanks!


*** Select statement

Select
  HD_TICKET.ID,
  HD_TICKET.PARENT_ID,
  PARENT_HD_TICKET.ID As ParentKACEID
From
  HD_TICKET Inner Join
  HD_TICKET PARENT_HD_TICKET On HD_TICKET.CUSTOM_FIELD_VALUE14 =
    PARENT_HD_TICKET.CUSTOM_FIELD_VALUE14
Where
  HD_TICKET.HD_QUEUE_ID = 59 And
  PARENT_HD_TICKET.HD_QUEUE_ID = 59 And
  PARENT_HD_TICKET.IS_PARENT = 1 And
  HD_TICKET.IS_PARENT = 0 And
 HD_TICKET.PARENT_ID = 0


*** Update statement

update
 HD_TICKET
Inner Join HD_TICKET PARENT_HD_TICKET On
HD_TICKET.CUSTOM_FIELD_VALUE0 =  PARENT_HD_TICKET.CUSTOM_FIELD_VALUE0
    set  HD_TICKET.PARENT_ID = PARENT_HD_TICKET.ID
  where
  HD_TICKET.HD_QUEUE_ID = 59 And
  HD_TICKET.IS_PARENT = 0 And
        (HD_TICKET.ID in (<TICKET_IDS>))

Answer Summary:
Cancel
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answer Chosen by the Author

0
When rules run on save I believe that KACE appends a "AND HD_TICKET.ID = <TICKET ID BEING SAVED>", but I'm not positive.
Answered 11/30/2015 by: chucksteel
Red Belt

Please log in to comment

Answers

0

Ah - ok.  I removed the  (HD_TICKET.ID in (<TICKET_IDS>)) from the update SQL and repeated all the select logic and it now works fine :-)

Your answer pointed me in the right direction  thanks

Answered 11/30/2015 by: VSwift
Senior Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity