Question: What is the best way to add redirect function into the save button on a newform in SharePoint 2013.

When the user create a list item, he/she should be redirected to another form.
Is it possible to get and parse the new generated item ID?

Start - Newform URL: <http://mysharepoint.com/sites/project/lists/alist/NewForm.aspx>

End - Editform URL: <http://mysharepoint.com/sites/project/lists/alist/EditForm.aspx?ID=88>

Thanks

Answer: 
### Add the URL of the next form as the &Source=[url] parameter

The Source parameter in the URL is where the browser is redirected to after a Form is saved.
Open an EditForm and investigate the URL
The URL has to be URL encoded (and it needs to be within the SharePoint domain)

```
https://xxx.sharepoint.com/sites/VM/Lists/Tasks/NewForm.aspx
?Source=
 https%3A%2F%2Fxxx.sharepoint.com%2Fsites%2FVM%2FLists%2FTasks%2FAllItems%2Easpx
&RootFolder=

```

So if you replace that Source with URL of a NewForm

```
https%3A%2F%2Fxxx.sharepoint.com%2Fsites%2FVM%2FLists%2FTasks%2FNewForm.aspx

```

You can add an item and then be returned to a Blank NewForm

### On that new form you will have to add code to retrieve the last added ID

You can do it with JavaScript code or put a hidden ListView WebPart on the NewForm page that lists the last created item and then use some script to extract what you need and update the fields in the Form

... takes just a bit of scripting
Danny gave a great answer already, but in case someone is looking to do this within a SharePoint-Hosted App, you can create a custom button within Default.aspx with this code:

```
<asp:HyperLink CssClass="menuLink" runat="server" NavigateUrl="JavaScript:window.location = _spPageContextInfo.webAbsoluteUrl + 
            '/Lists/ListName/NewForm.aspx?Source=' + _spPageContextInfo.webAbsoluteUrl + '';" Text="Add New List Item" />

```

This button will bring the user to the NewForm.aspx and after they save, it will bring them back to Default.aspx in the App / Add-in Web