Showing posts with label Workflows. Show all posts
Showing posts with label Workflows. Show all posts

Saturday, October 8, 2011

Exception of type 'System.Workflow.ComponentModel.WorkflowTerminatedException' was thrown

This is the error you see when you use the TerminateActivity in Windows workflow foundation/Visual Studio workflow development for SharePoint applications. The main reason behind why this exception is "We are terminating the current running workflow in middle and framework rises the exception that the workflow is terminated".

The main use of this TerminateActivity is for terminating workflow only. But, I do not recommend to use this activity in your workflows as this is a kind of exception which is throwing by WWF framework. Instead we could try

  • Filter the logic by if, else and end the workflow.
  • By throwing the exception from your code and by using the FaultHandler catch the exception and write it to logs.
  • If we want to stop the workflow, we may write the code to stop the workflow by using CancelWorkflow(workflow).
  • Even if you use the activity if you do not want to  see the above exception in the workflow logs then you might do this. From the "Properties" window the attribute "Error" – fill this field with some text like "Workflow terminated as the reviewers not found for the current item" etc. So that user can understand the error clearly instead of the exception details.

Hope it helps.

Thursday, September 30, 2010

Update the Nintex workflow to multiple lists and libraries in a SharePoint site

Special thanks to Vadim Tabakman.
 It is a special requirement. Nintex workflows are very  helpful in some scenarios to achieve things in simple and easy way. I got a requirement that I have to implement a workflow which needs to be used in many document libraries and list. As we know the SharePoint limitation, we can not apply the workflow for the content type. So, the only way we can do is adding workflow to each and every library needed. This is difficult, but I believe this is the only way we have to proceed. The big problem here is, when we have the requirement to change the workflow according to new changes then the problem starts. We have to change it in each and every library or list where workflow is deployed. This is very difficult in real time. So, we need some other way which we have to do automation. I am googling for the solution and luckily I found a wonderful solution here.

I will explain you very detail what "Vadim Tabakman" solution is.
He has created a document library and custom list which are used to add or update the custom nintex workflow in all libraries and lists.

Friday, February 12, 2010

Declarative workflows cannot automatically start if the triggering action was performed by System Account

This is the exception came to me today when I try to run a workflow on a list when an item is created. I tried different combination and didn't get the problem resolved. Even I removed all workflow conditions and actions and placed a simple update like update the title of the item in workflow body. Still that didn't give me the result. The workflow  is not starting at all automcatically.

After some research found that, when we are using system account [With the account we installed SharePoint], the workflows won't run automatically. This is looking crazy but that is what the problem. When I try to run them manually, then they are running absolutely fine, but they aren't starting automatically.

When I try to login with another account other than system account, no problems. Workflow starts automatically. The only reason is "if we install SP1 package, then declarative workflows can no longer be triggered by the SharePoint System account" as there is the possibility of security vulnerability. So, they didn't give access to run the declarative workflows under the System account.

So, friends, if you face any type of these problems make sure you login with some other account other than system account. Hope this helps to save at least 2-3 hours of time.