Salesforce Development | Insurance Software development

Salesforce Script To Fetch Object

Author - Webner
|
12:51 pm
|
0 Comments
| |

Salesforce script to fetch object which contains fields using fields API

When we work with objects in salesforce, sometimes we need a few things dynamically like a list of object names that contain field with a given API name of the field. So, here is a script that gives us all the objects which contain those fields.

String fieldAPI = ‘fieldAPI__c’; // API name of field to be searched
List sObjectList = new List();

//fetching objects which will be used to get field names
for(Schema.SObjectType eachShema : Schema.getGlobalDescribe().Values()){
String objectName = eachShema.getDescribe().getName();

// Exclude all the unwanted sObjects […]

Salesforce Development Best Practices

Author - Webner
|
5:20 am
|
0 Comments
| |

Salesforce Development Best Practice

There are various approaches for developing code in salesforce but there is always one way which is better than others. So here is a list of best practices that should be followed while working in Salesforce.

Apex
1. You can write the code in any format as you want but you should use the capitalization for class names. For example:

public class EmployeeDetails{}

Use Camel case for function and variable names. For example:

String empId = ‘’;
Public function employeeAdd{}

You should keep in mind that the name should be descriptive for anyone who […]

Website security
Contact Us