Helpdesk App Creation Help

I currently have a helpdesk app created that will go out to
SQL, use a SELECT MAX statement to get the next ticket number when
opening a new helpdesk ticket, and assign this ticket number to the
new ticket before it is filled out and then it is submitted along
with the rest of the ticket info. It was the simplest way to do it
at the time of creation.
Now I am having the problem of duplicate ticket numbers in
the table because if someone has opened a new ticket but not yet
submitted it, and then another user starts a new ticket it will
have the same ticket number as the other user since it is still the
next highest number in the table. Sorry if this is confusing.
I am wondering if there a way for Coldfusion or SQL to
reserve a number without submitting it to the table? Or would I be
better off having it determine a ticket number on one page,
submitting it, and then going into an update screen on the next
page? That way the ticket number is submitted and won't be
duplicated. Any help would be appreciated.

Here are some of the steps that I think you should follow:
1) Let the person fill-in the form. At this time there is no
ticket number.
2) Once the person is done and submits the form, do the form
validation
on the form page itself.
3) On the action page, get the max(ticketno) using SQL.
[Use appropriate CFML syntax for the following code.]
if max(ticketno) = 0 then
newTicketNo = 1
else
newTicketNo = max(ticketno) + 1
end if
4) Use apropriate CFTRANSACTION tag attribute. It would be
BEGIN in this
case. Inside it, use CFTRY and CFCATCH tages. Now, insert a
row into the
table. CATCH any database exception. You can know the exact
error
message (whether primary key violation or something else). If
there are
no errors, COMMIT your transaction.
5) You just have successfully inserted a row. Now, use the
newTicketNo
on the subsequent page to show the user that a ticket has
been created
and his/her ticket number is newTicketNo.
Remember that databases have concurrent access, many people
can query
the database. The idea here is to generate the new ticket no.
(or any
primary key, for that matter) at the very end when you are
ready to
insert the row into the database. In case your insert fails,
you can
find out if it was integrity constraint violation and
re-query for
max(ticketno) and repeat the procedure.
Hope this helps.
- Milind Joshi
Redcarl wrote:
> I currently have a helpdesk app created that will go out
to SQL, use a SELECT
> MAX statement to get the next ticket number when opening
a new helpdesk ticket,
> and assign this ticket number to the new ticket before
it is filled out and
> then it is submitted along with the rest of the ticket
info. It was the
> simplest way to do it at the time of creation.
>
> Now I am having the problem of duplicate ticket numbers
in the table because
> if someone has opened a new ticket but not yet submitted
it, and then another
> user starts a new ticket it will have the same ticket
number as the other user
> since it is still the next highest number in the table.
Sorry if this is
> confusing.
>
> I am wondering if there a way for Coldfusion or SQL to
reserve a number
> without submitting it to the table? Or would I be better
off having it
> determine a ticket number on one page, submitting it,
and then going into an
> update screen on the next page? That way the ticket
number is submitted and
> won't be duplicated. Any help would be appreciated.
>

Similar Messages

Maybe you are looking for

  • Pedido de Compra - Envio de e-mail para o fornecedor

    Boa tarde pessoal Estou com uma dúvida sobre o processo para envio de e-mail do Pedido de Compra para o fornecedor. Hoje utilizamos o e-mail do último aprovador no Pedido de Compra para que seja enviado ao fornecedor. Existe alguma configuração para

  • Materialized view fast refresh raising error ORA-12031

    Hi All, I have a table named TblA on A database. I have created mview name mviewTblA on database B. When I tried to Complete refresh on mviewTblA it is getting refresh but with fast refresh it is raising an error i.e ORA-12031: cannot use primary key

  • BAdI Change Display in Shopping Cart

    Hi, Has anyone activated the functionality that allows you to change the display of the shopping cart? If yes, what can you actually alter with it and where did you find useful documentation? Jerry

  • Display transparent panel over JFrame

    Hi I need to display a transparent panel (or even just a panel for that matter) on top of the other components in a JFrame, this would be like a notification box that can come and go away, but it should not be a JFrame, instead a floating JPanel. Bas

  • Deleting old and setting up new iCloud email address

    I am trying to figure out how to delete an old .mac email address permanently, then initiate a new .me address. This used to be simple, ( maybe it still is? ), with MobileMe where you could just open those preferences and add or delete accounts. But