I have a field for a custom document library, that must only be updated from code (event receiver) not from UI. So i set this field ShowInNewForm=“FALSE” and ShowInEditForm=“FALSE”. But this time, in code i cannot access this field. When trying to access the field inside code, it throws exception that says there is no field like this. But when i remove ShowInNewForm=“FALSE” property in content type, i can access the field and its value inside the code. Is there anybody who knows why does it work like this?
Provided the column is bound against the list you're using then it's always available in code regardlesss of the ShowInNewForm/ShowInEditForm settings.
Double check that the item you're working with is of the correct content type and that your list actually does have the right columns bound in the first instance.