In the same queue (not a process), I want to copy information from the parent to the child when the child is created.
The info to copy: Title, Priority and due date

I know this is the easiest thing to do but I'm not getting it.

1 Comment   [ + ] Show Comment

Comments

  • And big forehead slap!
    Makes perfect sense of course.

    Now the question is this, I have the parent, select Save and Create Child, so it should copy it at that moment, right? Maybe that's not possible b/c even if it's set OTS it's not showing on screen that the info was copied.
    Ugh. SQL and I are not the best of friends.
Please log in to comment

Answers

0
Something like this....

-- SELECT SQL:
SELECT PARENT.TITLE, 
HD_TICKET.TITLE, 
HD_TICKET.ID, 
PARENT.DUE_DATE
FROM HD_TICKET PARENT, HD_TICKET
WHERE PARENT.ID = HD_TICKET.PARENT_ID
and PARENT.HD_QUEUE_ID = 1
and C.HD_TICKET_ID = HD_TICKET.ID
AND HD_TICKET.ID IN (<TICKET.IDS>)


-- UPDATE SQL:
UPDATE HD_TICKET PARENT, HD_TICKET
SET HD_TICKET.TITLE = PARENT.TITLE,
HD_TICKET.HD_PRIORITY_ID = PARENT.HD_PRIORITY_ID,
HD_TICKET.DUE_DATE = PARENT.DUE_DATE
)
WHERE PARENT.ID = HD_TICKET.PARENT_ID
and C.HD_TICKET_ID = HD_TICKET.ID
and HD_TICKET.HD_QUEUE_ID = 1
AND HD_TICKET.ID IN (<TICKET_IDS>)


Make sure to change the queue ID to whatever queue you need this for. I suggest creating a test queue and testing there first.
Answered 01/12/2015 by: h2opolo25
Red Belt

  • Thanks. I tried this and got a 1064 error. Changed the Q ID to 11 but it doesn't seem to like that (see the LIMIT 1 below...?)
    Here's the error: mysql error: [1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') and HD_TICKET.HD_QUEUE_ID = '11' LIMIT 1' at line 5] in EXECUTE("SELECT COUNT(*) FROM HD_TICKET PARENT, HD_TICKET WHERE PARENT.ID = HD_TICKET.PARENT_ID and PARENT.HD_QUEUE_ID = 11 and C.HD_TICKET_ID = HD_TICKET.ID AND HD_TICKET.ID IN () and HD_TICKET.HD_QUEUE_ID = '11' LIMIT 1")
  • It's working. Just had to put a comma. Thanks so much!
Please log in to comment
Answer this question or Comment on this question for clarity

Share