This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<Sobject> sObjectList = <---provide list of Objects eg: Schools---> | |
String orderBy = <---provide orderBy field Name eg: School Name---> | |
String order = <--ASC or DESC---> | |
List<Sobject> resultList = new List<Sobject>(); | |
Map<object, List<Sobject>> sortMap = new Map<object, List<Sobject>>(); | |
if(sObjectList.isEmpty() || orderBy || order) return; | |
for(Sobject ob : sObjectList){ | |
if(sortMap.get(ob.get(orderBy)) == null) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@isTest | |
public class TestAccountCommon { | |
// setup test data for entire test methods in teh test class | |
@testSetup static void setup(){ | |
List<Account> lstAccounts = new List<Account>(); | |
for(integer i = 0;i<5; i++){ | |
lstAccounts.add( new Account( | |
FirstName = 'Test'+i, | |
LastName = 'user', | |
PersonEmail = 'test'+i+'@.com', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Author: Hasantha Liyanage | |
* Created: 2014-12-15 | |
* Summary: This will update the UserPreferencesHideS1BrowserUI field and make the Salesforce1 User | |
* field on User object false | |
**/ | |
// get the users who does not have salesforce1 mobile feature enabled | |
List<User> users = [ | |
SELECT | |
Id, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* isValidId | |
* | |
* This will check weather the value provided as the ID is exactly | |
* mathes its format with using regex | |
* | |
**/ | |
static public String validateId(String Idparam) { | |
String id = String.escapeSingleQuotes(Idparam); | |
if((id.length() == 15 || id.length() == 18) && Pattern.matches('^[a-zA-Z0-9]*$', id)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// read the parameter values and get the values | |
var jobId ='{!$CurrentPage.parameters.jobId}'; | |
// pass the values and retrive the URL | |
var urls = sforce.apex.execute("globalClass","getURL",{jobId:jobId}); | |
document.getElementById("banner").src = urls; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* getRecordTypeId | |
* Author: Hasantha Liyanage | |
* Created: 2014-12-01 | |
* Arguments: sobjectName: the name of the object we want to get the record type for; | |
* recordTypeName: the name of the record type we want to fetch | |
* Returns: If found returns the id of the record type, if not returns null. This | |
* method retrives recordtypes with using metadata. | |
**/ | |
public static Id getRecordTypeId(String sobjectName, String recordTypeName) { |