Monday, March 28, 2011

SPD Workflow: Custom action won't work

Yeah... The SPD WF is still in use in my project..

There are several benefits of using them:
 - easy to tailor to users' needs on the fly.
 - easy to understand by non-developers
  - can be done by non-developers.

There are (of course , as everything is in life)  minuses:
 - it's not transferable to another environment (but with extra effort-  it's possible  - explanation is here a hard-coded list id replacement )
 - it's not so flexible as a coded workflow
 - there is now way to debug it as easily as a coded workflow.

For some reason we use the SPD Workflow with custom written actions.
 Even  you are done with the step of writing the custom action. The second step - "using of the custom action" can be frustrating.
Based on my experience - the most common issue with the custom action in  the Sharepoint Designer Workflow is - it's appeared in the drop down list "Actions" , when you select  - it doesn't appear in the workflow.

That's my favorite one) - you won't find any trace of the errors in any logs.

I have found the concise and really helpful "how-to" fix the mysterious issues in the SPD WF - Common Pitfalls in SharePoint Designer Custom Actions
  • When you select a custom activity from the Actions drop-down, nothing happens
    • Usual suspect: the class name and assembly reference do not match in ACTIONS file and DLL. Please check that your class reference in the Action tag in the ACTIONS file exactly matches your DLL full name.
    • Not so usual suspect: SPD has a cached reference of your old DLL. Exit SPD, delete ApplicationData\Microsoft\WebSite Cache\ folder and restart SPD.
    • Even less usual suspect: You've correctly placed the ACTIONS file and the activity DLL, but you haven't added an authorizedType element into your web application web.config file. Add the correct entry (you can check the whole process here) and try again.
  • When you bind a property to a value, it doesn't get set
    • Usual suspect: the demoted property name in your DLL and in ACTIONS file do not match. Please check that all your properties in the code exactly match the Parameters section elements in your ACTIONS file.
 P.S. Thank you