/build/static/layout/Breadcrumb_cap_w.png

Copy from parent to child in same queue

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
  • 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. - celestialpickles 6 years ago

Answers (1)

Posted by: h2opolo25 6 years ago
Red Belt
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.

Comments:
  • 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") - celestialpickles 6 years ago
  • It's working. Just had to put a comma. Thanks so much! - celestialpickles 6 years ago

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ