Query a result from a custom value
Hello,
I'm attempting to have a field listed in my service desk for my technicians for a phone number to call back on. The phone number field has to be populated based on the query that returns back from the prior custom query and selection.
example:
CUSTOM_1 query:select full_name from USER ORDER BY full_name
CUSTOM_2 query:select work_phone from USER WHERE user_name = %custom_2%
What should replace the %custom_2% ??
If I update the value selected from Custom_1, will custom_2 auto-update with the phone number?
Thanks!
Answers (2)
Have you tried it? If it doesn't work, you might consider setting up two ticket rules to handle this (and use the Order field to ensure the full_name gets applied first). Here's one to help with the full_name (which I'm also using in my setup):
Frequency:
on Ticket Save
Select Query:
SELECT HD_TICKET.ID AS ID FROM HD_TICKET
JOIN USER S ON (S.ID = HD_TICKET.SUBMITTER_ID)
WHERE (HD_TICKET.HD_QUEUE_ID = 1 and HD_TICKET.SUBMITTER_ID <>0)
X Run an update query, using the results from the one above
Update Query:
UPDATE HD_TICKET T
JOIN USER S ON (S.ID = T.SUBMITTER_ID)
SET T.CUSTOM_FIELD_VALUE0 = S.FULL_NAME WHERE T.ID=<TICKET_IDS>
Hope that helps!
John
Comments:
-
John you beat me to the punch! - WhitzEnd 11 years ago
The Queries for the custom fields are looking directly at the database to fill in their information. They are nor looking at the selected value in a ticket. There is not a way with only the custom fields to have one populated based on what is chosen in another.
There might be able to be done using a custom ticket rule since it looks directly at the values in a ticket.