We need to create a Receipt number service to generate below format and need reset form next sequence no to 1 every midnight using some other schedule service.
We manage to get the form next sequence no created reference no.
FormReceiptSequenceDao formRecieptDao = new FormReceiptSequenceDao();
def sequence = formRecieptDao.getCurrentReceiptSequenceNumber(form);
But how do we reset the value to 1 in schedule service?
We tried below but throwing below error message.
FormReceiptSequence recSeq = new FormReceiptSequence(); recSeq.setForm(myFormDao.getFormByFormCode("FORMCODE"));
Cannot insert duplicate key row in object 'dbo.form_receipt_sequence' with unique index 'ui_form_receipt_sequence'. The duplicate key value is (72).
A sequence is automatically created for each new form that is deployed in TM. The sequence cannot be reset to ensure uniqueness of all form submissions for a form.
The only way to start with a new sequence is to deploy the form with a new form code.