SitecoreUnicorn / Unicorn

A Sitecore utility designed to simplify deployment of Sitecore items across environments automatically
MIT License
269 stars 116 forks source link

Option to exclude field from serialized user yml file #385

Open zaheer-tariq opened 4 years ago

zaheer-tariq commented 4 years ago

Do you want to request a feature or report a bug? Feature

What is the current behavior? We are serializing users for a domain using the config below.

<userPredicate type="Unicorn.Users.UserPredicates.ConfigurationUserPredicate, Unicorn.Users" singleInstance="true">
    <include domain="test" pattern="^((?!Anonymous).)*$" />
</userPredicate>
<userSyncConfiguration removeOrphans="true" defaultPassword="123456789" minPasswordLength="1" singleInstance="true" />

We use this user to login via code and perform some automated tasks in Sitecore. The user's created field value e.g. "Created: "2020-05-11T11:17:55.0000000Z" in the yml file keeps changing each time we sync and this appears as a change on Git. This sometimes also results in merge conflicts. We would like to avoid this by either ignoring this field via something similar to fieldFilter. Or ignore future changes to the yml file (this specific one only) but still keeping the file on Git as we will need that user in Sitecore when we rollout changes to other machines/environments.

If the current behavior is a bug, please provide the steps to reproduce.

What is the expected behavior? There should be a possibility to serialize a user only once or exclude a given field from serialized users yml file.

Please mention your Sitecore version and Unicorn version. Sitecore: 9.0.2 Unicorn: 4.0.8

markgibbons25 commented 4 years ago

I don't know if it would work but have you tried to exclude that field specifically? http://www.flux-digital.com/blog/excluding-specific-fields-unicorn-serialisation-field-filter/

Also I'd recommend updating to the latest unicorn as that version has known issues.