Hi,
Unfortunately you don’t have access to the ID until after the form is saved. What you should do is to format your link like this (note that the form must have DFFS for this to work, and you must have a field in the list with FieldInternalName “_DFFSID”):
<a href="{viewitemlink}">Link to item</a>
This will give you a link like this:
/site/list/DispForm.aspx?DFFSID=12345
When you get to your DispForm, DFFS detects the DFFSID query string parameter and gets the correct item by a query and then reloads the page with the correct ID.
Alexander