.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

InvalidOperationException on a workflow condition

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :JavaScript/VBScript


I'm creatinga .Net 3.5 C# State-Machine Workflow project in Visual Studio 2010 (for compatability reasons).
Several workflows are already up and running, but this new one I created doesn't.

I created a custom Declerative Rule Condition called "IsTaskNotEmptyTask" for an IfElseActivity. The condition is very simple:

this.IsTaskEmptyTask != True

Whenever this activity is reached, I get this exception:

"Unable to evaluate Condition \"IsTaskNotEmptyTask\" as there are validation errors."

 I tried using another condition and even changing it to:

True But it doesn't seem to change the behaviour.

Any idea where to start handling this issue?
I know my question is low on detail, so please let me know if there's anything I can include to help solve this.

Thanks! Edo

View Complete Post

More Related Resource Links

System.InvalidOperationException: Instance operation is not valid on workflow runtime thread

Am getting the exception related in the title of this article when using the StateMachineWorkflowInstance object to arbitarily set state in my workflow code; and am unsure why.  The code follows below:   500     Protected Overrides Function Execute(ByVal executionContext As System.Workflow.ComponentModel.ActivityExecutionContext) As System.Workflow.ComponentModel.ActivityExecutionStatus   501    502    506         Dim smwi As StateMachineWorkflowInstance = New StateMachineWorkflowInstance(StaticWFRuntime.LocalRuntime, Me.WorkflowInstanceId)   511    512         'set workflow-wide database connection string   513         _connectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString   518    519         Utility.LogEnabled()   520    521         Utility.FoaeaLogger.WriteEntry("Processing TracingApplication.Execute()....", EventLogEntryType.Information)   522         If StaticWFRuntime.LocalRuntime Is Nothing OrElse StaticWFRuntime.LocalRuntime.IsStarted = False Then   523             Utility.FoaeaLogger.WriteEntry("No static RuntimeService object exists!", EventLogEntryType.Warning)   524         End If   525    526         Return MyBase.Execute(executionContext)   527    528     End Function   796     Private Sub gotoState2_ExecuteCode(ByVal sender As System.Object, ByVal e As System.EventArgs)   797    798        

Workflow 3.5 Activity property is null in condition and nowhere else

I have an activity that has properties that look something like this (they're set up as proper dependency properties, I just kept it simple here): public List<MyType> TypeList { get; set; }public Int32 Index { get; set; }public MyType SelectedType { get; set; } and an execution that just does this: SelectedType = TypeList[Index]; TypeList and Index are values that I set from other activities. I don't set SelectedType to anything in the activity properties, I just let it get set in the execution. Now I know for a fact that SelectedType is getting set properly, I can even point another activity to it and print out some values from it. So I'm quite positive that there's nothing wrong with that activity. However, I have an if activity with a condition that looks like this: ((MyActivity)GetActivityByName("activity1")).SelectedType != null and it evaluates to false (meaning it evaluated SelectedType as null). I'm pretty sure that that activity cast is correct (I do things like that all the time), and if it weren't wouldn't I get a null reference exception when trying to access SelectedType? So I'm pretty sure I'm not doing anything wrong here, but for some reason SelectedType is coming up null in that condition and no where else. It's almost as if the condition is being evaluated before the activity is being run, but the activity comes well before the condi

Creating a workflow condition based on document type

Hello! I'm creating a workflow for a Document Library. I only want the action in the workflow to be executed on the condition that the document is of a certain document type. Any suggestions how I should do that? Thanks!

Workflow that moves item from one library to another, with condition: 1 year old.


I have Sharepoint 2007, and i now want to make a workflow that moves one year old item from one library to another, so that the old documents do not show in search. I have made the workflow, but i cannot see how i can set the condition that IF the item is older that ONE YEAR, it will be moved to another library.

I want to do this so that I can keep my old news-item not showing in search results.

If someone have other suggestion (besides workflow) to keep old items out from search results, I would appreciate tips :)



Workflow condition problem



I have a scenario and not sure if this can be attained via workflow:

< I have a list, and 3 columns in this list needs to updateable by only a particular set of users. I want to design a workflow which will help me achieve this.

I tried the following condition:

If CurrentItem:Modified by <> {user1,user2,user3}

then update item in current item {FY = 'None'}

This condition fails when a user tries an updates the list, the "FY" column automatically get over-written by "None"

I need to retain the FY column value if its previous been updated by {user1,user2,user3} and not set it to none

Can some one please help me

"Does not contain" condition on a choice field in a SPD Workflow does not apply/work


I am trying to check a multiple choice field on containing a specific value but it doesn't really work. I am not sure if that is because I have a

problem with the logic or if that is a SPD problem.

I created a Content Type "Test CT" (based on the "item" content type) and added two Site Columns of the type "choice", named "Test Column 1" and

"Test Column 2" to that content type. Both choice fields are configured to contain multiple values and can contain the identical values "Product

ABC" and "Product XYZ". Additionally I added Site Column of the type "Single Line of text", named "Result" to the content type. Then I added the

content type to the custom list "Test List".

Now I built the Reusable Sharepoint Designer Workflow "Test WF" that is based on this content type and that works like this:


Set "Result" to String "Start"

If "Test Column 1" contains String "Product ABC"
Set "Result" to String "Test Column 1 contains ABC"

Else If "Test Column 1" does not contain String "Product ABC"
Set "Result" to String "Test Column 1 does not contain ABC"


Then I

SPD workflow logic or calculated column... Very long condition - possible need for contains and begi


We have a lookup column on a SharePoint list with some 500 entries.  There is going to be a business rule where we want to include a URL link in a workflow email alert if one of 30 entries is selected from that lookup column. the rule might allow for if begins with XYZ or if Contains XYZ, or maybe not. But only if the the entry qualifies.

We need to send the email alert regardless, but if one of the 30 is selected, we need to send the user some extra fixed text and a url link that will have the list row id in a the uRL query string.  For example.

This record requires more information, please click here:

where here is an html a href pointing to  http://somewebform?ID=<id of my row>

So we also do need to format some html into the alert as well.  Recipients will be reading alert emails in Outlook 2007 with HTML turned on. The link will be to a form outside sharePoint and the sharepoint row must have been added before user can visit that form.

 Is there a Contains or Begins with type funciton in the Calculated column.

Is there way to condition blocks of text in a SPD worflow with a condition

Share Point 2010 Workflow throws error Workflow Failed to run when using a Pause Untill condition


I need to define a workflow where every night it checks the end date and if it is in past it should delete that list item. To achieve this I defined two workflows on the list which satrt when item created or modified. One workflow just checks the date and if past deletes the item. Another workflow I have defined as timer workflow which pauses untill 1am next day and then updates a hidden filed in the list item which triggers another instance of the timer workflow as well as deletion workflow.

Everything works fine if I remove the pause Until action, but if I use Pause Until or Pause For Duration the workflow does not resume and throws error workflow failed to run.

I googled and found this issue with 2007 and some hotfixes but could not find any solution for 2010 Anyone experienced the same issue?

Free Series of SharePoint Workflow How-to Videos

This is the series of "How to" Document Workflow with SharePoint using Visual Studio 2008 (using the .NET Framework 3.0 for backward compatibility to Visual Studio 2005). I have created video's that show the most common requests that I have seen around MOSS/SharePoint 2007 workflow & document workflow.

how to multiple condition in if statement in asp.net C#



i am using if condition to find out a time

if(time=="08 AM)


response.write"shift A";


but problem is how can i put multiple condition in if like

if(time=="06 AM" and "08 AM" and "07 AM")

Workflow Services: Visual Design of Workflows with WCF and WF 4


The .NET Framework 4 makes it easier than ever to implement WCF services using WF. We'll demonstrate just how easy it is by modeling a long-running, durable and instrumented workflow based on a real-world business case without having to write any code.

Leon Welicki

MSDN Magazine May 2010

Workflow Essentials: Collaborative Workflow Improvements in SharePoint 2010


In this article, the author covers the new features in SharePoint 2010 geared for workflow developers and then walks the reader through a couple of new user scenarios.

Paul Andrew

MSDN Magazine November 2009

Foundations: Workflow Services for Local Communication


This month's column describes how to use WCF for communication between a workflow and a host application in Windows Workflow Foundation 3. This knowledge should help developers with their efforts using WF3 and prepare them for WF4, where WCF is the only abstraction over queues (referred to as "bookmarks" in WF4) that ships with the framework.

Matthew Milner

MSDN Magazine November 2009

Foundations: Windows Workflow Design Patterns


Design patterns provide a common, repeatable approach to solving software development tasks, and many different patterns can describe how to accomplish a certain goal in code. When developers begin working with Windows Workflow Foundation (WF), they often ask about how to accomplish common tasks with the technology. This month's column discusses several design patterns used in WF.

Matthew Milner

MSDN Magazine August 2009

ASP.NET Workflow: Web Apps That Support Long-Running Operations


Integrating workflow into ASP.NET applications means communicating with activities via a workflow queue and hosting the runtime in the global application class. We'll show you how.

Michael Kennedy

MSDN Magazine January 2009

Real-World WF: Best Practices For Windows Workflow Foundation Apps


The heart of Windows Workflow Foundation is its declarative programming model. Here are some best practices to consider when using WF to realize software solutions in the real world.

Josh Lane

MSDN Magazine December 2008

Foundations: Workflow Tips and Tricks


Matt Milner addresses reader requests for information about safely sharing a persistence database across applications and using lesser-known parts of the framework such as ChannelManagerService.

Matt Milner

MSDN Magazine August 2008

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend