Showing posts with label SharePoint Designer workflow. Show all posts
Showing posts with label SharePoint Designer workflow. Show all posts

July 8, 2016

Microsoft.Workflow.Client.ActivityValidationException: Workflow XAML failed validation when deploying solution with workflow

Problem:
I created the Workflow in SharePoint Designer 2013 and used "Save As Template" to export a workflow as WSP solution file into Site Assets library.  And then took the WSP file and deployed it to target environment.  However, when the workflow was updated, the "Feature" that enables/publishes the workflow was not activated in the target environment as previously. It was giving following exception: 

“Microsoft.Workflow.Client.ActivityValidationException: Workflow XAML failed validation due to the following errors:
Failed to create a 'ListId' from the text '$ListId:Lists/configuration;'. HTTP headers received from the server - ActivityId: 4b8fd97c-7c0f-4b12-8038-247a513a3f00. NodeId: . Scope: . Client ActivityId : 6768869d-f0de-3000-2122-c09145073f7d. ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.
at Microsoft.Workflow.Common.AsyncResult.End[TAsyncRe……..”

Findings:
The "Elements.xml" file, which is packaged within the "WSP" solution file contains 2 different "<File>" elements. One <File> element represents the XAML file, and the other represents the Workflow association file. Comparing the Elements.xml file from a working solution file with the one which gives the specified error, I noticed that "WSPublishState" property value was different.  In the working solution file, WSPublishState value for each "<File>" element was "3" while in the failing version it was "1".

<PropertyName="WSPublishState" Value="3"/>

<PropertyName="WSPublishState" Value="1"/>
Note: WSPublishState property is also added within the "MetaInfo" tag in same file, so both occurrences should be updated.

Therefore, when the workflow files were published, due to different states it was corrupting the deployment process.

Resolution:
To resolve, please follow below steps:
1. Open WSP package using Project ->New Project -> ‘Import solution package’ from VS 2012/2013.
2. When solution is opened in VS 2012/2013, update the Elements.xml file.
3. Update the WSPublishState value for both "File" elements so they match. 

·       Note: Make sure you also update WSPublishState property within the ‘MetaInfo’ element if they differ. The actual value may matter (has not been tested); but if the values are both changed to "3" (to match the working version), then it works. Then again package the solution to create new WSP file, which will now deploy correctly.

The value of the WSPublishState corresponds to the 
Microsoft.SharePoint.WorkflowServices.StoragePublishState enumeration (viewed using Reflector):

internal enum StoragePublishState

{

    Unchanged,

    Unpublished,


    Published,


}

If you have any questions you can reach out our SharePoint Consulting team here.

July 6, 2016

Microsoft.Workflow.Client.ActivityValidationException: Workflow XAML failed validation due to the following errors: Failed to create a 'ListId' from the text

Problem:

I have created a Designer workflow for SharePoint 2013 List in development site and moved it to production environment. In Production environment, when I tried to activate the feature related to my custom workflow after uploading and activating the workflow package into the Solution Gallery, I encountered the error:

Microsoft.Workflow.Client.ActivityValidationException: Workflow XAML failed validation due to the following errors: Failed to create a 'ListId' from the text....

Cause:
I forgot to create one dependency List related to workflow solution in Production environment and tried to activate feature. Because of this, I encountered the above error.

To Solve this, I have created the dependency list and tried to activate the feature again, even this time I encountered the same error.

Resolution:
Because of the workflow instance that has already been created during the first erroneous deployment process, We need to delete that workflow instance through SharePoint designer and then re-activating the feature. This has solved my problem and workflow has been created successfully.


If you have any questions you can reach out our SharePoint Consulting team here.