7

I need to serialize some custom WFFM save actions in my solution but would like to avoid needing to store each one in its own folder on the filesystem. Is there a way to indicate that I want to serialize /sitecore/system/Modules/Web Forms for Marketers/Settings/Actions/Save Actions and just one or two of its children and place the serialized children all into the same filesystem folder?

2
  • 1
    If i understand the question correctly, you want to exclude some child items from the parent item? you can use exclude function that unicorn provides - <include database="master" name="WFFMSaveActions" path="/sitecore/system/Modules/Web Forms for Marketers/Settings/Actions/Save Actions"> <exclude path="/sitecore/system/Modules/Web Forms for Marketers/Settings/Actions/Save Actions/xxx"/> <exclude path="/sitecore/system/Modules/Web Forms for Marketers/Settings/Actions/Save Actions/YYY"/> </include> This only applies to unicorn 3 and above. Sep 4 '17 at 12:44
  • Please could you post that as an answer! FYI I'd prefer not to explicitly list all the things I don't want to serialize, if possible. Sep 4 '17 at 12:48
11

Unicorn 3 and above has an option to exclude child items under parent item. In your case you can use as below:

<include database="master" name="WFFMSaveActions" path="/sitecore/system/Modules/Web Forms for Marketers/Settings/Actions/Save Actions">
          <exclude path="/sitecore/system/Modules/Web Forms for Marketers/Settings/Actions/Save Actions/xxx"/>
          <exclude path="/sitecore/system/Modules/Web Forms for Marketers/Settings/Actions/Save Actions/YYY"/>
</include>

With unicorn 4 you can also exclude using namePatterns and templateIds:

<include database="master" name="WFFMSaveActions" path="/sitecore/system/Modules/Web Forms for Marketers/Settings/Actions/Save Actions">
          <exclude templateId="{3B4F2B85-778D-44F3-9B2D-BEFF1F3575E6}" />
          <exclude namePattern="^__Standard values$" />
</include>

This exclusion makes items not to be serialised by unicorn. More information about exclusions in unicorn can be found in this blog post

3
7

One way to do this using Unicorn 3 is with <exclude> and <except> elements. This can be done like so:

<include name="xxxxxx.Foundation.CustomWffmFieldTypes.SaveActions"
         database="master"
         path="/sitecore/system/Modules/Web Forms for Marketers/Settings/Actions/Save Actions">
  <exclude children="true">
    <except name="My Custom WFFM Save Action"/>
  </exclude>
</include>

This approach is described here: https://github.com/kamsar/Unicorn/blob/ce1e7aacdb65d53cffa617f8a11106dd70b944e0/src/Unicorn.Tests/Predicates/TestConfiguration.xml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.