[SalesForce] How to find required fields for an sObject

I know the question has already been posted, and answers where given ;
I read this topic ;
Of course I can try to insert the sObject and get the error listing the missing fields,

But isn't it a 'better' way to do it ?

I'm pretty sure I had found a way, but can't find it anymore ;

At this moment my favorite option remains to use the Schema Builder in wich it's obvious (red lines in front of each required attribute) –>

enter image description here

But isn't it a way to show a column required / not required, in the object manager ? –>

enter image description here

Same question, in the dev console ? –>

enter image description here

Thanks for your help !

Best Answer

Please note that fields can be made required via other means which are difficult or impossible to detect. Validation rules, triggers, and Process Builder can all introduce errors when a field is not populated (sometimes more intentionally than others).

Given the above, you can still iterate the describe to find which fields are practically required if you like. Here is a script showing how to do so.

for (SObjectField field : SObjectType.MyObject__c.fields.getMap().values())
{
    if (!field.getDescribe().isNillable())
    {
        system.debug(field);
    }
}