Query to retrieve Technician and Requestor Ticket Convos - URGENT
Hi Folks -
I need a MSSQL query to retrieve the Technician and Request communication History. I have tried this query but nothing is executing.
- select nw.workorderid "Request ID", nw.notificationid "Conversation ID",
'Outgoing' "Conversation type",
DATEADD(s,datediff(s,getutcdate(),getdate())+(n.notificationdate/1000),'01-01-1970')
"Sent on", aau1.first_name "From", nr.recipient_email "To",
n.notificationtitle "Subject", nd.description "Conversation",
sd.attachmentname "Attachment" from notificationtodesc nd
left join notify_workorder nw on nw.notificationid=nd.notificationid
left join notification n on nd.notificationid=n.notificationid
left join Notification_Recipients nr on nd.notificationid=nr.notificationid and nr.TO_CC_BCC='TO'
left join SDUser sdu1 on n.senderid=sdu1.userid
left join AaaUser aau1 on sdu1.userid=aau1.user_id
left join notify_attachments na on n.notificationid=na.notificationid
left join sdeskattachment sd on na.attachmentid=sd.attachmentid
where nw.workorderid=1234567
UNION ALL
select
c.workorderid "Request ID", cond.conversationid "Conversation ID",
'Incoming' "Conversation type",
DATEADD(s,datediff(s,getutcdate(),getdate())+(c.createdtime/1000),'01-01-1970')
" Sent on", aau.first_name "From", cr.recipient_email "To", c.title
"Subject", cond.description "Conversation", sd.attachmentname
"Attachment" from conversationdescription cond
left join conversation c on cond.conversationid=c.conversationid
left join SDUser sdu on c.requesterid=sdu.userid
left join AaaUser aau on sdu.userid=aau.user_id
left join ConversationRecipients cr on cond.ConversationID=cr.ConversationID and cr.TO_CC_BCC='TO'
left join conversationattachment ca on c.conversationid=ca.conversationid
left join sdeskattachment sd on ca.attachmentid=sd.attachmentid
where c.workorderid=1234567
order by 1,4
I'm on the latest Version of SDP. Any help is greatly appreciated, thank you!
New to ADSelfService Plus?