get all available fields of SObject

Anyone know how I can get all available fields in an Object in Salesforce. Thisngs I am trying to do is build out a component that user can select fileds and the model will populate with those fields only.

Rebuilding the skuid builder, eh?

I’m not sure there’s a declarative way to grab a full list of fields on an object. I’m not sure of your use case, but the table does have a setting that would “Allow Users to Reorder Columns,” and the users can show and hide columns as needed. You could set up the table’s model to include all of the most commonly used fields, and then leverage this table setting (pulling in every field could could run into Apex heap size errors if you’re pulling too much data into the page). The table settings are found under this icon: 

Thanks Mark,
The thing we are trying to do is, we are removing some of our users completely out of Salesforce and use only skuid. So trying to facilitate the option to create view that users normally create in Salesforce. Is it possible to do that in Skuid?



It would take quite a bit of work, but I think you could do what you’re after with an approach that leverages the existing skuid page builder.

The skuid builder already has the ability to get a list of fields when given a model, and skuid shows us how to build custom components with a “field” property (see examples of all the available properties here:

I’m guessing that you could build a custom component (and component pack) that would pull in the skuid builder javascript resources into the runtime environment using the manifest files.


You can get a list of fields for an Object using the FieldDefinition object.  I think there is even a checkbox field that will render true/false for whether the running user should see this field.

Zach McElrath put together a snippet that will save the sort order for a Skuid page. This will give you a starting point for how to manipulate a model on page load using some saved parameters.




I’m not quite understanding the FieldDefinition object. How do I tell it what my object is in order to get the fields for it?


Here is page that I use with the Field Defintion object:

<skuidpage unsavedchangeswarning="" personalizationmode="server" showsidebar="false" useviewportmeta="true" showheader="true">
        <model id="User" limit="1" query="true" createrowifnonefound="false" datasource="salesforce" type="" sobject="User">
                <field id="Name"/>
                <field id="Id"/>
                <field id="SearchTerm" uionly="true" displaytype="TEXT" label="Search Term"/>
                <condition type="userinfo" value="" field="Id" state="" operator="=" enclosevalueinquotes="true" userinfotype="userid"/>
        <model id="FieldDefinitions" limit="200" query="false" createrowifnonefound="false" datasource="salesforce" type="" sobject="FieldDefinition">
                <field id="DeveloperName"/>
                <field id="DataType"/>
                <field id="Label"/>
                <field id="Precision"/>
                <field id="Id"/>
                <field id="EntityDefinitionId"/>
                <field id="ControllingFieldDefinitionId"/>
                <field id="NamespacePrefix"/>
                <field id="MasterLabel"/>
                <field id="QualifiedApiName"/>
                <field id="Length"/>
                <condition type="fieldvalue" value="Account" enclosevalueinquotes="true" field="EntityDefinition.QualifiedApiName" operator="=" state="filterableon" inactive="false" name="EntityDefinitionId"/>
                <condition type="fieldvalue" value="" enclosevalueinquotes="true" field="Label" state="filterableoff" inactive="true" name="Label" operator="contains"/>
        <pagetitle model="FieldDefinitions" uniqueid="sk-Sw6Bc-278">
            <maintitle>Field Definitions</maintitle>
        <panelset type="standard" uniqueid="sk-SyXu1-530" scroll="">
                <panel type="left" width="225px">
                        <basicfieldeditor showheader="true" showsavecancel="false" showerrorsinline="true" model="User" buttonposition="" uniqueid="sk-SyaO4-542" mode="edit">
                                <column width="100%">
                                        <section title="Search" collapsible="no" showheader="false">
                                                <field uniqueid="sk-Sy-fz-593" id="SearchTerm"/>
                        <buttonset model="User" uniqueid="sk-Sysh--570" position="left">
                                <button type="multi" label="Search" uniqueid="sk-Syt9q-575" icon="sk-icon-search">
                                        <action type="setCondition" model="FieldDefinitions" condition="Label" value="{{$}}"/>
                                        <action type="requeryModel" model="FieldDefinitions" behavior="standard"/>
                                <button type="multi" label="Clear Search" uniqueid="sk-SzNcr-182" icon="sk-icon-cancel">
                                        <action type="updateRow" fieldmodel="User" affectedrows="context" field="SearchTerm" enclosevalueinquotes="true"/>
                                        <action type="deactivateCondition" model="FieldDefinitions" condition="Label"/>
                                        <action type="requeryModel" model="FieldDefinitions" behavior="standard"/>
                                <button type="multi" label="Query" uniqueid="sk-T6CPt-287" icon="sk-icon-refresh">
                                        <action type="requeryModel" model="FieldDefinitions" behavior="standard"/>
                            <renderconditions logictype="and"/>
                        <skootable showconditions="true" showsavecancel="false" showerrorsinline="true" searchmethod="client" searchbox="false" showexportbuttons="true" pagesize="all" alwaysresetpagination="false" createrecords="false" model="FieldDefinitions" buttonposition="left" mode="readonly" allowcolumnreordering="false" responsive="false" uniqueid="sk-SuHVb-97" emptysearchbehavior="query" tokenizesearch="true" instantfilters="false">
                                <field id="Label" hideable="true" uniqueid="fi-SuK2c-117" valuehalign="" type=""/>
                                <field id="QualifiedApiName" hideable="true" uniqueid="fi-31lF52-257" valuehalign="" type=""/>
                                <field id="DataType" hideable="true" uniqueid="fi-SuK2Y-116"/>
                                <field id="Precision" hideable="true" uniqueid="fi-SuK2g-119" valuehalign="" type=""/>
                                <field id="Length" hideable="true" uniqueid="fi-31lQdQ-313" valuehalign="" type=""/>
                                <field id="NamespacePrefix" hideable="true" uniqueid="fi-31l0xN-203" valuehalign="" type=""/>
                            <massactions usefirstitemasdefault="true"/>
                                <view type="standard"/>
                                <filter type="select" filteroffoptionlabel="New Filter" createfilteroffoption="false" affectcookies="true" autocompthreshold="25" conditionsource="manual" labelmode="no" condition="EntityDefinitionId">
                                        <source type="manual" effectsbehavior="justdefault">
                                                <option label="Account" type="simple" value="Account"/>
                                                <option label="Contact" type="simple" value="Contact"/>
                                                <option label="Opportunity" type="simple" value="Opportunity"/>
                                                <option label="Lead" type="simple" value="Lead"/>
                                                <option label="Task" type="simple" value="Task"/>
                                                <option label="Event" type="simple" value="Event"/>
                            <exportproperties usetablecolumns="true" appendrowidcolumn="false" loadallrecords="true"/>
        <styleitem type="background" bgtype="none"/>



That works like a champ