function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Finding out if a field is required

I'm using the Partner WSDL in V2.5 of the API and I have a problem with the Field object.  I do a describeSObject for an Object and then go through each of the fields returned.  The problem is that I don not see a .required property on the field?

All other documented properties are on the field object but I can't find .required 

Any Ideas?


Glenn Wilson


Hi GlennW,

Not what you want to hear, but, the required bit is not currently part of the field definition returned from the describe call.  The only workaround is to call the describe with 2.0 to determine if the field is a "system" required field.  I qualify that as "system" because fields can be marked as required depending on the layout.  In this case, the field is not required by the system, but the user of the app have deemed it to be required on the layout.  To determine this, you will need to use the 2.0 describe call with the display option.

I am logging a request to have the "system" required attribute restored to the field definition.




Has this been resolved?   Is there a way to tell if a field is a "system" (layout) required field?  (for example: ActivityDateTime in Event)


Is this still true for partner wsdl version 8.  I will be nice to know which fields are required or not.  Thanks.
the nillable property describes if a field is required to have a value or not. Note that some fields also have defaultOnCreate set, which indicates that the server will provide a value if none is specified.