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
DaneshDanesh 

Best practices for generating forms for SObjects with custom fields dynamically from the API

We're trying to handle custom fields for things like Tasks. Is there any best practice for doing things dynamically? We've made a webapp that lets users from various organizations connect. So it's not just one organization that we're looking at.

The form should allow users to create a new Task, including specifying all of the custom fields. I'd like to do this in as few API calls as possible.

I know that when looking up an object, we get back all of the custom fields. However, for things like a custom picklist, from what I understand, we'd have to make a separate API call to figure out the values that it could possibly have. So when we create the page to edit the task, and there's a custom picklist, then that would mean at least one call to find the task, another to populate the picklist on our end. Is there another way to do it apart from manually? Or do I have to make 1 call to find the task, another to find the possible values of each picklist, etc etc.

Is there a better way of doing this sort of thing?

Similarly, if certain profiles have permissions, is there a way to access this information in 1 API call as well?
Best Answer chosen by Danesh
DaneshDanesh
Answered here - http://salesforce.stackexchange.com/a/51522/11722