Skip to main content

Cloud

SharePoint workflow: Activity validation failed – Can not find the condition

On a large SharePoint project with multiple custom components, we reached a point where we had to reorganize our projects and solutions to maintiain a tighter order on the project. In the process, the project files were moved – some were rebuilt, some replaced, some consolidated.
One project was a custom SharePoint workflow that included a custom Activity living inside a Replicator Activity. The Replicator Activitiy had some custom rules, which of course were stored in the .rules file.
When we tried to recompile the project, Visual Studio kept insisting that it couldn’t find the condition ‘AllTasksComplete’, which we recognized as the custom condition we had set. The rules file was there, and had the condition intact. Very frustrating.
  • Activity ‘replicatorActivity1’ validation failed: Can not find the condition "AllTasksComplete".
In the end, we found that somehow in all the moving around of the Project files, the .rules file became disassociated from the workflow .cs file.
It’s simple enough to reassociate it:
  1. Open the .csproj file in Notepad
  2. Find the section where the .rules file is referenced. It will look something like this:
    • <EmbeddedResource Include="MyWorkflow.rules" />
  3. Alter this tag to include the DependentUpon tag:
    • <EmbeddedResource Include="MyWorkflow.rules" >
      <DependentUpon>TheWorkflow.cs</DependentUpon>
      </EmbeddedResource>
  4. Save the .csproj file
  5. Recompile the solution

This should do the trick.

Thoughts on “SharePoint workflow: Activity validation failed – Can not find the condition”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.