locked
Workflow to redirect user to another page RRS feed

  • Question

  • Hi guys,

    Here is the situation that I'm facing:

    I want to design a workflow that will get triggered automatically to redirect a user to another page after they fill out a form for entering information to a SharePoint list (preferably the page right before the form is filled out and saved). I want this to be done because I don't want the user to see the page where the information is being stored from the form, but rather I want them to be returned to where they were working before filling out the form. Is there a way to design a workflow to do just that? Thanks a bunch.


    Friday, July 8, 2011 3:57 PM

Answers

  • Hi petabread1214,

    Sorry for my not clear description.

    For the workaround above, it is usually done with SharePoint Designer which is a tool for SharePoint design, as I haven’t found a way without it, if convenient, you can download one from here(it is for free and useful for SharePoint): http://www.microsoft.com/download/en/details.aspx?id=21581

    1.        Open the site that contains the list, (Click File->Open Site, type the url of the site),

    2.        Find the list in the left folder list part, (A library will show directly, a list is in the folder of lists).

    3.        Open the NewForm.aspx (Change to the code show view).

    4.        Paste the code above under the line of <asp:Content ContentPlaceHolderId=”PlaceHolderMain” runat=”server”>

    Change the newSrcUrl to the page that you want the user to redirect to.

    If you have other questions, please feel free to ask.

    Thanks,

    Qiao Wei

     

    • Marked as answer by Wayne Fan Monday, July 18, 2011 5:59 AM
    Tuesday, July 12, 2011 2:21 AM
    Moderator
  • Hi,

     

    In this situation, you need to do more than design a workflow to redirect user to another page.

     

    To meet your needs that let the user not see the page where the information is being stored from the form after they finish the form, here I have a workaround for you: Create a new page (.aspx) like thanks.aspx, modify the NewForm.aspx of the form.

     

    Place the code below under the line <asp:Content ContentPlaceHolderId=”PlaceHolderMain” runat=”server”>

    <script type="text/javascript" language="javascript">
    function PreSaveAction() {
    var srcUrl=GetSource();
    var newSrcUrl = "
    http://www.yournewpage.aspx";
    var i = aspnetForm.action.lastIndexOf(srcUrl);
    aspnetForm.action = aspnetForm.action.substring(0,i) + newSrcUrl ;
    return true;
    }
    </script>

     

    Also, there is an example about “Redirect from NewForm to EditForm or custom page’, for more information, please refer to:

    http://sharepointjavascript.wordpress.com/2009/09/04/redirect-from-newform-to-editform-or-custom-page/

     

    Thanks,

    Qiao Wei

    • Proposed as answer by McDerface Wednesday, July 13, 2011 5:40 PM
    • Marked as answer by Wayne Fan Monday, July 18, 2011 5:59 AM
    Monday, July 11, 2011 10:46 AM
    Moderator

All replies

  • Hi,

     

    In this situation, you need to do more than design a workflow to redirect user to another page.

     

    To meet your needs that let the user not see the page where the information is being stored from the form after they finish the form, here I have a workaround for you: Create a new page (.aspx) like thanks.aspx, modify the NewForm.aspx of the form.

     

    Place the code below under the line <asp:Content ContentPlaceHolderId=”PlaceHolderMain” runat=”server”>

    <script type="text/javascript" language="javascript">
    function PreSaveAction() {
    var srcUrl=GetSource();
    var newSrcUrl = "
    http://www.yournewpage.aspx";
    var i = aspnetForm.action.lastIndexOf(srcUrl);
    aspnetForm.action = aspnetForm.action.substring(0,i) + newSrcUrl ;
    return true;
    }
    </script>

     

    Also, there is an example about “Redirect from NewForm to EditForm or custom page’, for more information, please refer to:

    http://sharepointjavascript.wordpress.com/2009/09/04/redirect-from-newform-to-editform-or-custom-page/

     

    Thanks,

    Qiao Wei

    • Proposed as answer by McDerface Wednesday, July 13, 2011 5:40 PM
    • Marked as answer by Wayne Fan Monday, July 18, 2011 5:59 AM
    Monday, July 11, 2011 10:46 AM
    Moderator
  • Thanks Qiao Wei for your response.

    I was wondering if you can explain a little more in detail as to how exactly to implement this script with the NewForm page (where user enters the information to the list) since I'm very new to SharePoint and definitely javascript. So I should make a new aspx page with the same functionality as the NewForm.aspx page (i.e. user enters information and click ok to get redirected back to the list he/she enters the information, which is where I want to change to direct them to somewhere else, the newSrcUrl in your javascript code) and add the javascript code to where you specified? What should I do after that because when I tried completing the form and click "ok" to submit the form, it just directs me back to the list page (where it would by default), is there anything else that I'm suppose to do?

    Monday, July 11, 2011 1:09 PM
  • Hi petabread1214,

    Sorry for my not clear description.

    For the workaround above, it is usually done with SharePoint Designer which is a tool for SharePoint design, as I haven’t found a way without it, if convenient, you can download one from here(it is for free and useful for SharePoint): http://www.microsoft.com/download/en/details.aspx?id=21581

    1.        Open the site that contains the list, (Click File->Open Site, type the url of the site),

    2.        Find the list in the left folder list part, (A library will show directly, a list is in the folder of lists).

    3.        Open the NewForm.aspx (Change to the code show view).

    4.        Paste the code above under the line of <asp:Content ContentPlaceHolderId=”PlaceHolderMain” runat=”server”>

    Change the newSrcUrl to the page that you want the user to redirect to.

    If you have other questions, please feel free to ask.

    Thanks,

    Qiao Wei

     

    • Marked as answer by Wayne Fan Monday, July 18, 2011 5:59 AM
    Tuesday, July 12, 2011 2:21 AM
    Moderator