8

Workflow is enabled in the system. All pages in the system are associated with the metadata schema. Adding a new check box field to the metadata schema with a default value results in auto selection of the check box for new pages, but not for the existing pages. If I manually select the check box it is working.

Please suggest me a solution to auto select the check box for the new field for all the existing pages using the metadata schema.

| improve this question | | | | |
  • FWIW, I describe Tridion's schema update behavior in this post, which applies to components as well as page metadata. See below for answers and suggestions after making the change. :-) – Alvin Reyes Feb 28 '13 at 7:58
  • Hi, if one of the answers below helped fix your issue, could you consider accepting it? (click the check mark next to that answer) – Bart Koopman Mar 4 '13 at 12:09
5

Most answers here already cover the approach to modify the content of the pages - as you probably found out by now, the XML records and their schemas are "disconnected", and to modify them you need to save them again.

An alternative option is to modify your templates to check for the presence of the field, and if the field is not present "pretend" it is present and checked. This will make the behavior identical for pages that have the value checked or pages that don't have the field at all, while not doing something for pages that have the value unchecked.

Obviously, the correct way to deal with this depends on what's best for your editorial team. Talking to editors sometimes saves us from over-engineering :)

| improve this answer | | | | |
9

You could write a .net Console application that uses the Tridion Core Service to update metadata on the existing pages.

Elena Serghie has written a guide to setting up the Core Service.

There's also this useful article on updating content with Core Service.

| improve this answer | | | | |
3

The default value supplied in a Schema field, will only be used upon first creation of the item. So as you experienced if you change the default value of a field, or add a new field with a default value to a Schema, your existing items will not be affected by that.

One way to change existing items is to write a program (or script) that will update your content and sets your default values. If the field is non mandatory, then this could easily be done by checking if the field is empty, or if it is a newly added field, then it wouldn't exist.

Options you have for the script/program is as Dave suggested, using the Core Service. If you require something more permanent (for instance setting a default value based on the value of another field, or always set a certain value in a field if that is empty upon save), you could also consider using the event system for that.

| improve this answer | | | | |

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.