views:

37

answers:

2

I've added a new section containing a couple of new fields to an existing data template. The fields appear correctly when logged in as a normal user account.

However when accessing the fields using the API, item.Fields["FieldName"] always returns NULL.

Things I've tried:

  1. Publishing both the item and the corresponding data template
  2. Granting "Everyone" explicit read access to the fields (and field section).
  3. Confirmed that my dev instance is pointed to the correct database
  4. Debugging shows that my two new fields are not in the item's Fields collection.

I've also executed an iisreset, just in case something was cached somewhere. Any help would be much appreciated.

+3  A: 

Try calling item.Fields.ReadAll() before accessing the field.

Yan Sklyarenko
Many thanks - that was the issue!
CodeToaster
That shouldn't be a necessary step, are you positive it's not a caching issue?
techphoria414
+1  A: 

Are you publishing and developing from the same sitecore instance? i've seen developers get frustrated by this b/c they are publishing from say, a development server, then looking for the field on their local dev box, which still has an old copy of the template cached. publishing on the dev server wouldn't clear the local cache in that case.

techphoria414