Generate serial Number from old submissions with max function

Dear colleagues:
we need to generate serial number for current submission from the last submission and +1 to the current by using xlsform and they will use ONA online submission to submit new data.
Is there any method for that?

@Moteb_Marei There is no easy way to auto-increment a globally unique ID without an always on connection. Your options are to generate a unique non-repeating ID or use some combination of metadata like device ID and data within the form to generate a probably unique ID.

If you'd like to increment a number across multiple submissions on a single device, you can use the ODK Counter app. Incremental counter has a link and sample form.