/build/static/layout/Breadcrumb_cap_w.png

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!


0 Comments   [ + ] Show comments

Answers (2)

Posted by: jverbosk 11 years ago
Red Belt
3

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
Posted by: WhitzEnd 11 years ago
7th Degree Black Belt
1

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.

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