/build/static/layout/Breadcrumb_cap_w.png

Dell K1000 - Service Desk - Parent/Child Ticket

Hello,

I'm looking for a possibility to use the name from the associated asset in the parent ticket for the child ticket.
I have just started with SQL scripting - hope somebody can help me..

In the ticket rule the SQL select works - the ticket rule give 2 rows back - the follow code row doesn't work and I don't know why.

HD.TICKET.TITLE = (SELECT NAME FROM ORG1.ASSET WHERE ORG1.ASSET.ID =
                  (SELECT ASSET_ID FROM HD_TICKET WHERE HD_TICKET.ID = PARENT_ID))


Thank you!


1 Comment   [ + ] Show comment
  • The error message I get is:
    'mysqli error: [1093: Table 'HD_TICKET' is specified twice, both as a target for 'UPDATE' and as a separate source for data]' - svmay 7 years ago

Answers (1)

Answer Summary:
Posted by: svmay 7 years ago
Red Belt
1

Top Answer

I have a Solution!

Here the whole SQL-update

update HD_TICKET as T
  join HD_STATUS as T5
    on T.HD_QUEUE_ID = T5.HD_QUEUE_ID
  left join HD_TICKET as PARENT
    on PARENT.ID = T.PARENT_ID
  left join ORG1.ASSET as A
    on A.ID = PARENT.ASSET_ID
set
  T.HD_STATUS_ID = T5.ID,
  T.TIME_OPENED  = IF(T5.STATE = 'opened', NOW(), T.TIME_OPENED),
  T.TIME_CLOSED  = IF(T5.STATE = 'closed', NOW(), T.TIME_CLOSED),
  T.TIME_STALLED = IF(T5.STATE = 'stalled', NOW(), T.TIME_STALLED),
  T.SATISFACTION_RATING = IF(T5.STATE = 'closed', NULL, T.SATISFACTION_RATING),
  T.SATISFACTION_COMMENT = IF(T5.STATE = 'closed', NULL, T.SATISFACTION_COMMENT),
  T.TITLE = A.NAME
where T5.NAME = 'Geplant' 
  and T.ID in (<TICKET_IDS>) ;

The SQL-update change the status from new to planed ('Geplant') and change the childticket title to the name from the associated asset in the parentticket.

 
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