Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 7025

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 2162

Deprecated: Hook imagify_allow_picture_tags_for_webp is deprecated since version 2.2! Use imagify_allow_picture_tags_for_nextgen instead. in /www/collab365_296/public/wp-includes/functions.php on line 5758
Deploy custom SharePoint 2013 workflows with site template - Collab365
Deprecated: strstr(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1145

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1152

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1155

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1162

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1165

Deprecated: strstr(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1145

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1152

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1155

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1162

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1165

Warning: Undefined array key "url" in /www/collab365_296/public/wp-content/plugins/thrive-visual-editor/thrive-dashboard/inc/smart-site/classes/class-tvd-smart-shortcodes.php on line 85

2015-02-10

It is common scenario when you did some customizations, saved site as template and want to reuse it in SharePoint 2013. Such site templates can include workflows with custom workflow actions. Unfortunately if you save site with custom workflow actions as template and then try to create new site you can receive such annoying error:

Microsoft.Workflow.Client.ActivityNotFoundException:The activity named 'WorkflowXaml_988fe3c3_dc3e_47a9_8ff3_c912c82eb56d'from scope '/spo/216722f1-1dc0-4c6d-aafd-86b12ef60a14/1f87e1ae-da77-44d4-92d1-502507b5f2d4/34ceaf02-5217-46be-a307-e09dd93da230' was not found. HTTP headers received from the server -ActivityId:224e672a-4e00-44ed-8b55-894a059608c2.NodeId:.Scope:.ClientActivityId: f6cadd9c-c011-1000-aa42-85eedd28fc19.--->System.Net.WebException:The remote server returned an error

The reason of such behavior is related to incorrect processing of template by SharePoint 2013. I described it in detail in other my blog article. But this article is not about reasons of such behavior. We created small utility program TemplatePackageFix which fixes site templates with custom workflow actions and allows to reuse them as many times as you need.

We decided to implement such utility because some of our customers had questions about correct site template provisioning. Especially when custom site template included workflow actions from our product Workflow Actions Pack

Use case – deploy a new web with configured workflows

Save Site as Template

The first step, you need to create a Site template. To do this navigate to Site Settings -> Save site as Template (In Site Actions section). If you don’t see this link you can navigate using direct link. For example:
https://yourSiteUrl/sites/WebUrl/_layouts/15/savetmpl.aspx

Then fill all the fields and check the checkbox “Include content” (If you don’t do this the workflows won’t be included into template).

When the operation will be completed, please download the WSP package from the solution gallery.

Click on the template to download it:

Patch the site template

As I described earlier if we try to create a new site we can get the following error:

Microsoft.Workflow.Client.ActivityNotFoundException:The activity named 'WorkflowXaml_988fe3c3_dc3e_47a9_8ff3_c912c82eb56d'from scope '/spo/216722f1-1dc0-4c6d-aafd-86b12ef60a14/1f87e1ae-da77-44d4-92d1-502507b5f2d4/34ceaf02-5217-46be-a307-e09dd93da230' was not found. HTTP headers received from the server -ActivityId:224e672a-4e00-44ed-8b55-894a059608c2.NodeId:.Scope:.ClientActivityId: f6cadd9c-c011-1000-aa42-85eedd28fc19.--->System.Net.WebException:The remote server returned an error

To avoid the error we have to patch the WSP package with help of a small utility TemplatePackageFix. I described it in detail in my previous article. This utility simply moves all workflows to separate feature. Thus, site will be created by template without workflows and then you will be able to activate the feature to deploy workflows.

You can download it from the following link. Please download it and extract to any directory.

To run, press “Win + R” and run the CMD. 

Next step is to specify path to the program and path to the WSP package which we downloaded. The command can look like this:

c:\YourFolder\TempatePackageFix.exe

After a few seconds you will see “fixed” message:

That is all. Your WSP package has been patched, all workflows have been moved to another feature.
The last step is to upload the WSP package to the solution gallery.

Create new Site based on saved template

Now you can upload patched wps package with site template to your solution gallery and activate it. Then, you can create a new site. To do this this navigate to “Site Contents”.

Then, scroll down and press “new subsite”:

Please fill all the fields and select your site template on “Custom” tab. Note, if you can’t find your site template, most likely you selected incorrect language.

The last step before you can use the site, you need to activate the “Workflow Actions Pack” feature (This will make available custom workflow actions) and “Template workflows” feature (it contains all your workflows).

Conclusion

I hope this small utility will save your time and simplify moving your customizations between farms and site collections. Should you have any questions feel free to comment.

Original article at the link Deploy custom SharePoint 2013 workflows with site template

(Visited 88 times, 1 visits today)

About the author 

Roman Rylov

Summit Bundle

Get 200+ hours of Microsoft 365 Training for 27$!

Master Office 365, Power Platform & SharePoint & Teams With 200+ Hours Of Training Videos and 108 Ebooks in the Collab365 Academy. This offer is insane and is only available for a limited period.