2

How do I find out what fields are required when I create a record in Salesforce using SOQL?

1

2 Answers 2

3

Joshua, I assume you're trying to do this programmatically in Apex. If so, you should be able to leverage Accessing All Field Describe Results for an sObject and Describe Field Result Methods to compile the list you're looking for, without even having to use SOQL: http://carvingintheclouds.blogspot.com/2013/09/listing-required-fields-for-object-in.html

2
  • I'm not using Apex do query, but the REST API in a Ruby on Rails application.
    – josh
    Sep 7, 2013 at 18:44
  • Hello, @JoshuaSmock, you can still use describe information via a REST API request. You can use Workbench to test this out and examine the raw JSON response from such a request, as erbdex suggested. Here's a quick video showing you how it's done (minus the last part where you are supposed to click the "Show Raw Response" link) at the top: screencast.com/t/k4BpXt8WNTjr
    – Marty C.
    Sep 11, 2013 at 1:51
0

Enter Salesforce Workbench.

In case you're not bound on Apex and are using the REST API, you can visualize all the fields and even generate queries. Also, you can run your custom queries.

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