/build/static/layout/Breadcrumb_cap_w.png

Ticket Rule Applying to All Tickets?

Is it possible to adjust this ticket rule so that it only applies to the ticket which is currently being saved? I have specified "on Ticket Save" for the Frequency, but when a ticket is saved and the rule runs, it is being applied to all of the tickets (which is a major problem).

I borrowed the code from the Auto populating user data in custom fields forum post here:
http://itninja.com/question/auto-populating-user-data-in-custom-fields&mpage=1&key=ticket%2Crule%2Ccustom&#82796

...and came up with the following, which copies the ticket submitter's full name into the Custom Field 2. My goal is to use this field for queries, so that when users are removed from the KBOX 1100 (after leaving the company), there will still be a way to search on tickets by those users' names, as removing user accounts sets the Submitter field to Unassigned for any tickets setup for those users. <hope that was clear>

Select:

SELECT HD_TICKET.ID AS ID FROM HD_TICKET
JOIN USER S ON (S.ID = HD_TICKET.SUBMITTER_ID)
WHERE HD_TICKET.SUBMITTER_ID <>0


Update:

UPDATE HD_TICKET T
JOIN USER S ON (S.ID = T.SUBMITTER_ID)
SET T.CUSTOM_FIELD_VALUE2 = S.FULL_NAME

The copy works, but unfortunately is applying to all tickets. Unfortunately, for those tickets with no Submitter specified (i.e. those tickets with termed submitters), it is just putting 0 in the Custom Field, which undermines my goal.

Hopefully I'm just missing something obvious...

Thanks very much for your help!

John C. Verbosky
Helpdesk Coordinator

0 Comments   [ + ] Show comments

Answers (2)

Posted by: GillySpy 13 years ago
7th Degree Black Belt
0
As long as the frequency = on ticket save then the select query is fine because it will automatically add this to the bottom of the query :
and HD_TICKET.ID= xxx

Your update however is not limited. You need to rewrite the update to be:
UPDATE HD_TICKET T
JOIN USER S ON (S.ID = T.SUBMITTER_ID)
SET T.CUSTOM_FIELD_VALUE2 = S.FULL_NAME
WHERE T.ID=<TICKET_IDS>

That last part will make sure that the ID (ticket number) from the select query is passed to the update
Posted by: jverbosk 13 years ago
Red Belt
0
Gerald,

Thanks *VERY* much for your help and for clarifying this. Everything is working now and I learned another valuable tip.

Keep up the great work!

John
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

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