I know this question has already been asked and answered a few times before only in reverse (i.e. Parent to Child). I specifically need to know the SQL commands for passing info from the Child to the Parent. In other words, I need the Owner of the Child to fill-in three custom fields and then have that information auto-populate into the corresponding three fields on the Parent ticket. Of course this should happen on save of the Child ticket.

Answer Summary:
Cancel
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answers

1

The rules are very similar to updating the child based on the parent, you just need to change a couple of values in the update statement:

 UPDATE HD_TICKET PARENT, HD_TICKET
SET PARENT.CUSTOM_FIELD_VALUE3 = HD_TICKET.CUSTOM_FIELD_VALUE3
WHERE ((PARENT.ID = HD_TICKET.PARENT_ID) AND HD_TICKET.ID = <TICKET_IDS>)

This worked for me in pretty limited testing.

 

Answered 03/26/2013 by: chucksteel
Red Belt

  • Thanks Chuck. I'll give that a try and update here.
Please log in to comment
1

It looks like I finally got this working. Apparently, KACE will append the actual ticket id to the where clause of the select statement for “on Ticket Save” rules. So, the select query ended up being a lot simpler than what I had thought originally.

Here is the final version that I used.

SELECT
 HD_TICKET.ID,
 HD_TICKET.PARENT_ID
FROM
 HD_TICKET
WHERE
 HD_TICKET.CREATED < NOW()

UPDATE
 HD_TICKET PARENT,
 HD_TICKET
SET
 PARENT.CUSTOM_FIELD_VALUE2 = HD_TICKET.CUSTOM_FIELD_VALUE0,
 PARENT.CUSTOM_FIELD_VALUE3 = HD_TICKET.CUSTOM_FIELD_VALUE1,
 PARENT.CUSTOM_FIELD_VALUE4 = HD_TICKET.CUSTOM_FIELD_VALUE2
WHERE
 PARENT.ID = HD_TICKET.PARENT_ID
 AND HD_TICKET.ID = <TICKET_IDS>

Answered 03/27/2013 by: svargas
Senior Yellow Belt

  • I'd recommend that you make your select statement a little more selective. For instance, you may want to make sure it only matches child tickets (where HD_TICKET.PARENT_ID = 0) and perhaps check to see if the custom fields aren't still the default values.
Please log in to comment
Answer this question or Comment on this question for clarity