How to delete a record if client crashes?

Hello everyone.

I want to ask a question about record management in AX 2012. 

I have a table of payments. When user opens Payment form, i insert a zero record to this table. After user enters the payment amount in the edit method field on the form, i process this payment and update the zero record with the processed information (the table has many fields that the entered payments are distributed between this fields). 

My question is: Sometimes (rarely), when a user opens Payment form, the client crashes and, the zero record i inserted at the Form Opening, stays in that table. But this is error for me. How can i make the record to be deleted if the client crashes? This have to be done immediately, because, when the user finishes his/her work, she/he must post this payment (posted) to Ledger.

 

Any help will be greatly appreciated. 

Thanks in advance.

  • if you know the table name then you can delete record from backend (DataBase), you need to write some SQL query for deletion in database .
  • you can try to make a condition to insert() method of your table, inserted values must be different from 0
  • In reply to Ajay Vishwakarma:

    Ajay, but what is user is still working on this zero record? Then i would delete the record that is currently in use and awaiting update.
  • In reply to Thomas Post:

    Thomas, at first, i have to insert zero record to work on it later, after the payment is distributed.
  • First, why are you expecting the client crash?

    what if the user closes the form with zero value?

  • In reply to Kranthi:

    Mostly, the users close it from Task Manager. Client rarely crashes, i wrote it as an example :)
  • In reply to Ilkin:

    Ilkin
    Mostly, the users close it from Task Manager.

    My question was, How do you handle the case if the user intentionally closes the form with zero value?

    Would you delete it while opening the form again?

  • In reply to Kranthi:

    Kranthi,

    I keep the track of newly created record by recid and, whenever the work finishes, i update the record using recid. if another form opens at the same time, the new record will be created andthe recid will do the work.
  • Ilkin
    I have a table of payments. When user opens Payment form, i insert a zero record to this table. After user enters the payment amount in the edit method field on the form, i process this payment

    So basically the data is temporary until you process the payment, so why cannot you use a temp table?

Related
Recommended