Warning users before creating new ticket?

Hi all,
Someone just asked me if I could add a feature to our RT installation, but
I don’t know how to go about it.

In our customer service queue, we have a custom field for the order number
to which the ticket refers. Sometimes, two different reps will start
working on the same order without realizing it, thus making the CF the same
order number for two tickets. The feature I’m being asked about is a check
for other tickets that have that same order number; if any exist, the user
gets a warning and can cancel their ticket. They are also told who owns the
original ticket.

I can see two pieces to this, and how to do them both. The lookup happens
in a script tied to ticket creation, and the warning is custom JavaScript
that simply pops up a confirm prompt. But how to put these two together is
where I’m stuck. How would the results of the script’s search get back to
Javascript, and how would OK/Cancel in the JS confirm box get back to the
script? Alternatively, does something like this already exist that I just
don’t know about? Thanks for any ideas on this.

Alex Hall
Automatic Distributors, IT department
ahall@autodist.com