I have a scenario where the users are required to add an item to a specific list. and then they should be redirected to another list automatically. the issue I'm having with the scripts I used was that the items are not being saved at the original list!

<script src="https://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
    function GetParameterValues(param) { 
        var url = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
        for (var i = 0; i < url.length; i++) { var urlparam = url[i].split('=');
        if (urlparam[0] == param) {
            return urlparam[1]; 
    $(document).ready(function () {
        // for Save button. You need to change it. 
        var button = $('input[name$="SaveItem"]');
        button.click(function () {
            var listUrl = "/sites/test1/Lists/testlist/NewForm.aspx";
            var itemId = GetParameterValues("ID");
            var elementName = $(this).attr("name");
            var aspForm = $("form[id=aspnetForm]");
            var oldPostbackUrl = aspForm.get(0).action;
            var currentSourceValue = GetUrlKeyValue("Source", true, oldPostbackUrl);
            var newPostbackUrl = oldPostbackUrl.replace(currentSourceValue, listUrl + "/EditForm.aspx?ID=" + itemId);
            WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(elementName, "", true, "", newPostbackUrl, false, true));

If you're using a SharePoint form, in the url for NewItem.aspx or whatever your input form is. If you add "?Source=" it will automatically redirect there after saving.

For Instance:


Will redirect to google after closing the form via save or cancel.

Another option is to have a custom save button

<SharePoint:SaveButton  RedirectUrl="http://urlhere" runat="server" ControlMode="Edit" id="savebutton"/>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.