workflow with anonymous access

We have a Request for Information form that can be accessed anonymously and the anonymous users have add and view priveleges. What we want is when the user submits the form to have a workflow kick off that sends an email to the user who submitted the form using the email address within the form data and also send an email to an administrator.

However, we are seeing some problems with anonymous users and workflow playing nice together.

·If a user is logged in (windows authentication), then the form works as expected, the data is stored in the database, the user is directed to the appropriate page and the workflow runs.

·If no workflow is tied to the list, the anonymous user can submit their request for information as expected. The data goes into the database and the user is directed to the appropriate page.

·If a workflow is attached to the list, the user can still submit their request and the data makes it into the database. However, the user remains on the same page and the error below is displayed.

The data source control failed to execute the insert command.

Web Parts Maintenance Page: If you have permission, you can use this page to temporarily close Web Parts or remove personal settings. For more information, contact your site administrator.

Troubleshoot issues with Windows SharePoint Services.

Is there something else that needs to be done to enable workflows to work with anonymous users?

Thanks

[4240 byte] By [david_jetstream] at [2008-2-24]
# 1
It turns out that the workflow runs as the currently logged in user. At this point, there is not a way to have the workflow run if it is kicked off by an anonymous user.
david_jetstream at 2007-9-5 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - Workflow...
# 2

As well, even if you don't set the workflow to auto-start ... it still throws the exception (it's actually an "Out of Memory" exception that gets thrown ... apparently according to Microsoft Support it is because it tries to retrieve the user object and there is none)

I'm trying to come up with a work around right now as I've been advised that they're not planning on fixing this with a hot fix but rather we will have to wait to have it fixed in the 1st service pack.

JoeC. at 2007-9-5 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - Workflow...
# 3

Thinking off the top of my head here, so I haven't tested this...could you have an event receiver kick off for the item, check if the user is named or anonymous and then either:

1. launch the workflow (if user is named)

2. Do some impersonation and then launch the workflow (if anonymous)

As I said, never tried event receivers on anonymous, you may have the same problem.

-Dave

DaveM. at 2007-9-5 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - Workflow...
# 4

I've now also tried using a custom event receiver and tried handling the ItemAdding event, however, attaching an event receiver to a list results in exactly the same behaviour as attaching a workflow (OutOfMemoryException)!

(The only difference is that with the event handler, since it throws the error sooner, the item doesn't actually get added, whereas with the workflow, the item gets added, and then the error is thrown)

JoeCataford at 2007-9-5 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - Workflow...
# 5

Ok. I've created a workaround for this issue since Microsoft will not be providing a fix until SP1 of SharePoint. Basically what I've done is as follows:

  1. Create a custom content type that inherits from the "Custom List" content type (you could also use any other content type to derive from). You don't need to define any additional fields unless you want. I'm just using a basic custom list and then adding fields at runtime.
  2. With the content type, create a custom rendering template (ascx file to be placed in control templates) that is almost the same as the ListForm template found in "DefaultTemplates.ascx" (the default form used to render list items).
  3. Modify the custom rendering template by removing the SharePoint save button and adding an ASP.NET button that posts back. Handle the button's OnLoad event to set it's visibility and handle the button's OnClick event to save the item.
  4. To save the item in the OnClick event, use the "SPSecurity.RunWithElevatedPriviliges".
  5. Package all of this in a solution and feature and deploy to your site. You can then create lists that use this content type to allow anonymous users to add items that have workflows or event handlers attached to them.
JoeCataford at 2007-9-5 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - Workflow...
# 6
any chance you have the source to your solution available somewhere?
lepr at 2007-9-5 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - Workflow...
# 7
Is there any way you can give more specific instruction on this? I am desparate at this point...
LewisL at 2007-9-5 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - Workflow...
# 8

Hi, would anyone provide the tailored template? I found trouble in implementing the onclick event to save the item.

Please, Please ....

annielhy at 2007-9-5 > top of Msdn Tech,SharePoint Products and Technologies,SharePoint - Workflow...

SharePoint Products and Technologies

Site Classified