Adding/Creating FieldSet in Salesforce

By | December 29, 2016

A field set is a grouping of fields for an object. Creating field sets in Salesforce is an easy way to dynamically query fields and dynamically binding the fields to display field sets on your Visualforce pages which can save you a big chunk of time. Field set is an out of the box feature provided by Salesforce and you can create field sets for Standard as well as custom objects and supports the inclusion of custom and Standard fields.

Read More: Your favorite GUMU™ Sage ERP integration now works on Salesforce Lightning Components!

How to create fieldset: The first step for this would be to create the Fieldset. For example, to create field set for Account object, Go to Setup > Customize > Accounts > Field Set. You can now drag and drop all fields you want in this fieldset.

How to Use field set in Visualforce page: If we are using standard controller, then using fieldset in visualforce is straight forward. You can use the global variable for fieldsets to access the field set you created to dynamic binding the fields in fieldset to the visualforce pages. In the interesting thing to note here is that the page will display only those fields which are part of the specified fieldset. So if in future you want to add or remove something from the visual force page, you don’t have to modify the page at all. You can simply add/remove the field from the fieldset.

Use Fieldset in Visualforce

Use Fieldset in Visualforce


Visualforce Page

Visualforce Page

How to dynamically query fields in Apex: We can use the dynamic SOQL to query the fields present in the fieldset. The schema namespace provides the metadata for the fieldset that can be used to build the dynamic SOQL query in Apex. This again gives you the advantage of selecting the fields based on the fieldset and would vary if you add/remove the fields in fieldset.

Dynamic SOQL query in Controller

Dynamic SOQL query in Controller

Please refer the URL for the Salesforce limits: Check now

About Us
Greytrix – a globally recognized and one of the oldest Sage Development Partner and a Salesforce Product development partner offers a wide variety of integration products and services to the end users as well as to the Partners and Sage PSG across the globe. We offer Consultation, Configuration, Training and support services in out-of-the-box functionality as well as customizations to incorporate custom business rules and functionalities that require apex code incorporation into the Salesforce platform.

Greytrix has some unique solutions for Cloud CRM such as Salesforce Sage integration for Sage X3Sage 100 and Sage 300 (Sage Accpac). We also offer best-in-class Cloud CRM Salesforce customization and development services along with services such as Salesforce Data MigrationIntegrated App developmentCustom App development and Technical Support to business partners and end users.
Salesforce Cloud CRM integration offered by Greytrix works with Lightning web components and supports standard opportunity workflow. Greytrix GUMU™ integration for Sage ERP – Salesforce is a 5-star rated app listed on Salesforce AppExchange.

The GUMU™ Cloud framework by Greytrix forms the backbone of cloud integrations that are managed in real-time for processing and execution of application programs at the click of a button.

For more information on our Salesforce products and services, contact us at salesforce@greytrix.com. We will be glad to assist you.

Related Posts