• PGX64
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

Hello,

 

Maybe I missed something, but I'm having trouble finding which fields are required based on the results of a describeSObjectResult.  I've tried searching through the documentation and other postings, but did not come up with much information.

 

What I'm trying to do is loop through the list of fields for a particular object (chosen at run-time) and mark each required field.  Unfortunately, it doesn't appear that the the Field objects found in the DescribeSObjectResult object have an "isRequired" method to easily tell.  I tried to cobble something together, assuming that if isNillable and isDefaultedOnCreate were both false, then it was required, but this doesn't appear to be completely accurate.

 

I would appreciate any help.  Perhaps I'm missing something or there is another approach that I can take. Thanks!

  • May 29, 2009
  • Like
  • 0

Hello,

 

Maybe I missed something, but I'm having trouble finding which fields are required based on the results of a describeSObjectResult.  I've tried searching through the documentation and other postings, but did not come up with much information.

 

What I'm trying to do is loop through the list of fields for a particular object (chosen at run-time) and mark each required field.  Unfortunately, it doesn't appear that the the Field objects found in the DescribeSObjectResult object have an "isRequired" method to easily tell.  I tried to cobble something together, assuming that if isNillable and isDefaultedOnCreate were both false, then it was required, but this doesn't appear to be completely accurate.

 

I would appreciate any help.  Perhaps I'm missing something or there is another approach that I can take. Thanks!

  • May 29, 2009
  • Like
  • 0