It's All Writing.

Writing makes you happy.


How to sort Objects by multiple fields at Apex

Environment Apex Premise You can sort List of Objects with using sort method as below. In above example, shops is sorted by name ascending order ( Shop A, Shop B, Shop C). But what if you want to sort by multiple fields in …

How to get Salesforce sObject's fields List that is sorted by field's name at Apex

Environment Apex Code String sobjectApiName = 'Account'; Map<String, Schema.SObjectField> fieldMap = Schema.getGlobalDescribe().get(sobjectApiName).getDescribe().fields.getMap(); List<String> fieldNames = new List<String>(fieldMap.keySet()); fieldNames.sort(); for (String fieldName: </string></string></string,>…