4

Is there an easy way to find the required fields for an objects? Is page layout the only way to see visually what fields are required for an object?

I am looking for a GUI tool not code.

3

I'm not sure if you have a way to see both fields required by page layout AND field level. It's an important difference - field level required or page layout required...

In standard salesforce, I don't think there's an easy way to quickly list required fields.

On the appexchange there are some apps available but I think they will only look at the field details and not take into account when fields are made required on the page layout.

The apps that I looked at before: "Object Metadata Snapshot Tool" (mind the reviews and comments on failing tests)

https://appexchange.salesforce.com/listingDetail?listingId=a0N30000003Ih3aEAC

Etherios Easydescribe: (still had this link somewhere in my mails but the app doesn't seem visible anymore on the appexchange)

https://appexchange.salesforce.com/listingDetail?listingId=a0N300000018leZEAQ

8

I think you can infer it, if a field is Createable and not Nillable and not DefaultedOnCreate.

SObjectType.Account.Fields.Name.Createable &&
!SObjectType.Account.Fields.Name.Nillable &&
!SObjectType.Account.Fields.Name.DefaultedOnCreate

The DescribeFieldResult does not surface this directly (thanks Farid Kognoz)

If you don't mind to use the SOAP API, you could also noodle at DescribeLayoutResult required attributes, though it's trickier and not all of an object's fields may be on the page layout.

  • I am looking for a GUI tool not code – Bartley Jan 28 '14 at 23:54
  • Nice solution @bigassforce I tried it with Contact object as i know LastName is mandatory in Contact. Schema.DescribeSObjectResult r = Contact.sObjectType.getDescribe(); Map<String,Schema.SObjectField> M = r.fields.getMap(); for(String fieldName : M.keySet()) { Schema.SObjectField field = M.get(fieldName); Schema.DescribeFieldResult F = field.getDescribe(); if(F.isCreateable() && !F.isNillable() && !F.isDefaultedOnCreate()) System.debug ('F = ' + fieldName); } – Kamruzzaman Sep 27 '18 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.