Forum Discussion

Fred Y's avatar
Fred Y
Iron Contributor
Sep 26, 2017

SharePoint Workflow Deleted Task

I have the following scenario on a SP2013 on-prem farm with a custom "approval" process using 2010 workflow platform: 

 

  1. The workflow successfully sends an email to the "Assigned To" person, 
  2. Workflow gets terminated since the item is no longer valid, then, 
  3. The user clicks the task link (Form_URN) and gets an error since the task is already deleted. 
    Sorry, something went wrong. 
    An unexpected error has occurred. 

Is there a way to redirect the URL below to a custom webpage to display that workflow has been canceled since the associated task is no longer available? 

https://siteURL/sites/sitename/_layouts/15/WrkTaskIP.aspx?List={guid}&ID={id}

 

This is just an extra measure even if the user receives the workflow cancelation email. 

 

Thanks, 
Fred

 

5 Replies

  • Fred Y's avatar
    Fred Y
    Iron Contributor

    Just some additional info. Will it be possible to redirect into another webpage so that can display the task was deleted or workflow was canceled rather than a generic error (see attached file)? 

     

     

    The log entry is as follows: 

    Application error when access /_layouts/15/WrkTaskIP.aspx, Error=Item does not exist. It may have been deleted by another user.   

     

    at Microsoft.SharePoint.SPList.GetItemById(String strId, Int32 id, String strRootFolder, Boolean cacheRowsetAndId, String strViewFields, Boolean bDatesInUtc, Boolean bExpandQuery)     

    at Microsoft.SharePoint.SPList.GetItemById(Int32 id)     

    at Microsoft.Office.Workflow.WrkTaskIPPage.OnLoad(EventArgs ea)

     

    • Eugene Booyens's avatar
      Eugene Booyens
      Copper Contributor

      Hi there, did you have any luck resolving this?  I just upgraded a 2010 farm to 2013 and having this problem on a tasks list.  Thank you!

      • Fred Y's avatar
        Fred Y
        Iron Contributor

        Hi, Eugene Booyens,
        Unfortunately, no luck in the actual resolution. The workaround I've created uses the following which applies only for "new" workflow activities.

         

        1. Used REST API and AJAX based JavaScript that checks if the Task exists. 

        2. Created a web part page called WrkTask.aspx that refers to the JavaScript in step 1.
          Created another web part page called WrkError.aspx that displays "Item Not Found" text. 

        3. Revised my workflow to point to the web part page in step 2. 
          [%Workflow Context:Current Site URL%]/SitePages/WrkTask.aspx?TaskId=[%Current Task:ID%]&ApprovalId=[%Current Task:Approval Item Id%]


        When the user clicks on the email link, the web part page in step 2 checks whether the Task still exists and redirects to the current Task item, otherwise, it redirects into WrkError.aspx page. 

        Fred Y

         

         

        Reference:

        SharePoint 2013 using REST API

Resources