4

I'm using sitecore 8.2. I have a list of the Template Field items where I need to check the "Enable field level fallback" field programmatically.

So, something like that:

foreach (var item in ListOfItems)
{
    item.Fields["Enablefieldlevelfallback"].Value = "1";
    break;
}

Any help would be appreciated.

1 Answer 1

4

Well, you don't provide much of a context. But API wise, it would come out like this:

        foreach (Item item in ListOfItems)
        {
            item.Editing.BeginEdit();
            item.Fields[FieldIDs.EnableLanguageFallback].Value = "1";
            item.Editing.EndEdit();
        }

For the Shared version of Language Fallback, change the constant.

        foreach (Item item in ListOfItems)
        {
            item.Editing.BeginEdit();
            item.Fields[FieldIDs.EnableSharedLanguageFallback].Value = "1";
            item.Editing.EndEdit();
        }
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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