Accessing content in a custom field

Hm, the above code example works for me as well, although the first time I got the error message and then after rebuilding it worked. So I wonder if that’s rather some caching issue, similar to what happened here: The section type "pagetable" is not valid