I need to run a workflow when a item is read/opened in a list. Just wondering if that can be done via SP Designer or Visual Studio.
Thanks
MS
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this communityTry with this:
By Code I don't think there is a Event Receiver when item is in read/opened mode so either you use Item Updating or Updated or any available event receiver to kick off workflow pragmatically or create custom list item viewer as mentioned by above by Arsalan.
The only way that I could imagine doing this is via the SharePoint web services ( http://msdn.microsoft.com/en-us/library/cc296356(office.12).aspx ) and some JavaScript (I'd use jQuery - http://weblogs.asp.net/jan/archive/2009/04/09/calling-the-sharepoint-web-services-with-jquery.aspx).
You would need to customize the DispForm.aspx ( http://chanakyajayabalan.wordpress.com/2009/11/27/creating-a-custom-sharepoint-list-form/ ).
I would suggest a very high degree of caution when doing this as the potential impact on server performance is dramatic.
This is not possible out-of-the-box, and I hope you have already figured it out...
I would suggest to add a Visual Web Part on the display form, and on the PageLoad of the web part check if the Workflow is already initiated or completed, if not that means the item is opened for the first time and you need to start the workflow, for starting a workflow programmatically follow this: http://www.sharepointkings.com/2008/09/how-to-start-workflow-programmatically.html
This will save a lot of performance issues... I hope this helps!