There is nothing in the code that you’ve provided that explains why some fields are not shown in some cases and you’ll need to supply more information. It could have to do with the type of field, it could have to do with where your code is located and how it’s called.