Thursday, March 6, 2014

SharePoint 2013 Workflow App Step won't work, gets suspended

Situation: SharePoint 2013, Workflow Manager 1.0 + the two CUs for Service Bus and Workflow Manager, List with workflow that has an app step (to allow it to read/write to other lists to which the user does not have access). Workflow App Step can't seem to do anything at all! Tried process of elimination and it seems like it cannot look up any field in my current item. When I look at the workflow right after it starts, the status says "Starting" with this message in the little "i" symbol:

Retrying last request. Next attempt scheduled in less than one minute. Details of last request: HTTP NotFound to https://MYSERVER/_vti_bin/client.svc/web/lists/getbyid('SOME_GUID_GOES_HERE')/Items(IdOfYourItem)?%24select=SOMETHING

After that, it gets a status of "Suspended" with detail in that little "i" icon of something awful like this (which is a web service result from that client.svc mentioned up there):
Details: An unhandled exception occurred during the execution of the workflow instance. Exception details: System.ApplicationException: HTTP 404 {"error":{"code":"-1, System.ArgumentException","message":{"lang":"en-US","value":"Item does not exist. It may have been deleted by another user."}}} {"Transfer-Encoding":["chunked"],"X-SharePointHealthScore":["0"],"SPClientServiceRequestDuration":["18"],"SPRequestGuid":["c38c92af-563c-073b-8950-19e9ab5d00ce"],"request-id":["c38c92af-563c-073b-8950-19e9ab5d00ce"],"X-FRAME-OPTIONS":["SAMEORIGIN"],"MicrosoftSharePointTeamServices":[""],"X-Content-Type-Options":["nosniff"],"X-MS-InvokeApp":["1; RequireReadOnly"],"Cache-Control":["max-age=0, private"],"Date":["Thu, 06 Mar 2014 22:07:22 GMT"],"Server":["Microsoft-IIS\/7.5"],"X-AspNet-Version":["4.0.30319"],"X-Powered-By":["ASP.NET"]} at Microsoft.Activities.Hosting.Runtime.Subroutine`1.SubroutineChild.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

Resolution: Turns out, the App Step can't get past those pesky list advanced settings where you set "item-level permissions" to "Read only their own". Yea, for that the workflow "app" would need to have higher or elevated permissions. Seems like the only way to do this is to A) Have an app catalog and B) Set the workflow "app" as having full control using a hidden app permissions page. You can find the step by step here (Microsoft) or here (Fabian Williams...the better one if you ask me). This applies to any action that might require full control or design-like permissions like creating lists, creating sites, etc. and applies to SharePoint 365 as well.

No comments:

Post a Comment