How to Transfer Success page After Insert item in SharePoint List using Sequential Work Flow?

Answered How to Transfer Success page After Insert item in SharePoint List using Sequential Work Flow?

  • Wednesday, August 08, 2012 6:28 AM
     
      Has Code

    Hi,

    i am Srinivas,

    In my Project i am using Sequential Work Flow to update Current List Item, it works perfectly but here i have a problem to transfer to Success page after item is Updated. 

    The Following is my code for update the list item using Sequential Work Flow :

     private void onWorkflowActivated1_Invoked(object sender, ExternalDataEventArgs e)
            {
                _site = new SPSite(workflowProperties.SiteUrl);
                _web = _site.OpenWeb();
                myList = _web.Lists["Leave Request"];
                _web.AllowUnsafeUpdates = true;
                SPListItem item = workflowProperties.Item;
                item["Name"] = "Srinivas";
                item.Update();
                SPUtility.TransferToSuccessPage("Thank you for registering a Membership You will receive an email with a temporary password once your request has been approved.");
            }

    in the above code update logic works perfectly but the TransferToSuccessPage is not works. 

    Please Help.

    Thanks

    Srinivas


    MO(LA)DDU

All Replies

  • Wednesday, August 08, 2012 6:42 AM
     
     

    Hi,

    The SPUtility.TransferToSuccesPage method can only be used in web pages or web parts. It cannot be used in situations which don't have access to the HTTP Response object (like Event Receivers and workflows).

    It makes sense because workflows can be started automatically or asynchronously and there wouldn't be an point in redirecting a non-existent user to a page.

    Regards,

    Nauzad Kapadia.


    Please "Mark as Answer" if a post has answered your question or "Vote as Helpful" if it was helpful in some way. Here's why

  • Wednesday, August 08, 2012 6:42 AM
     
     

    Hi

    Same question answered another thread

    http://social.msdn.microsoft.com/Forums/eu/sharepointdevelopment/thread/80e947b5-578a-43cd-9ebf-56c2b03f607e

    You cannot use SPUtility.TransferToSuccessPage in EvenReceiver. It works just from pages or web parts. I guess it happens because from EventReceiver TransferToSuccessPage method does not have the access to Response object.


    Please mark the replies as answers if they help or unmark if not.

  • Wednesday, August 08, 2012 7:16 AM
     
     

    Hi Nauzad Kapadia,

    Thanks For Your Reply,

    Please help me how can i display a Confirmation Message Box After Item is Updated in SharePoint List. Using Sequential WorkFlow.

    Thanks 

    Srinivas


    MO(LA)DDU

  • Wednesday, August 08, 2012 8:03 AM
     
     Answered

    Hi Srinivas,

    The short answer is that you can't. Workflows are basically asynchronous activities and hence cannot/should not have to do anything which involves real-time interaction with users. So if your objective is to somehow confirm to the initiator of the workflow that a list item has been updated, there are a couple of techniques you can use -

    1. Send an confirmation email

    2. Add a new column in the list, name is something like "Status" and let the workflow put a value like "List item successfully updated" in that column.

    3. Add an entry in the Workflow History list. 

    Regards,

    Nauzad Kapadia.


    Please "Mark as Answer" if a post has answered your question or "Vote as Helpful" if it was helpful in some way. Here's why

  • Wednesday, August 08, 2012 8:09 AM
     
     Answered

    If your workflow starts and died with the onWorkflowActivated1_Invoked you can try to use an ititiation form that wait for the workflow is terminated and then does redirect on the success page.


    Regards,
    Bubu
    http://zsvipullo.blogspot.it