Skip to content

Instantly share code, notes, and snippets.

Avatar
🙃
LWCC is live !!

Sebastien scolladon

🙃
LWCC is live !!
  • Paris France
View GitHub Profile
@scolladon
scolladon / ApexID15to18.cls
Last active Sep 23, 2016
Apex ID 15 to 18
View ApexID15to18.cls
public static string generate18CharId(final string id){
final String abecedair = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ012345';
if (String.isBlank(id) || (id.length() != 15 && id.length() != 18)) {
return null;
}
if (id.length() == 18) {
return id;
}
string suffix = '';
for (integer i = 0; i < 3; i++) {
@scolladon
scolladon / RecordTypeHandler.cls
Created May 16, 2016
Apex RecordType Handler
View RecordTypeHandler.cls
public with sharing class RecordTypeHandler {
// Build a local cache so that we don't request this multiple times
private static Map<Schema.SObjectType,Map<String,Id>> rtypesCache;
static {
rtypesCache = new Map<Schema.SObjectType,Map<String,Id>>();
}
// Returns a map of active, user-available RecordType IDs for a given SObjectType,
@scolladon
scolladon / UserRoleInserter.cls
Last active May 10, 2016
UserRoleInserter Salesforce
View UserRoleInserter.cls
public class UserRoleInserter{
final private Map<String,String> roleNamePerParentRoleName;
public UserRoleInserter(){
this.roleNamePerParentRoleName = new Map<String,String>();
}
public void PutUserRoleHierarchy(final String aUserRole, final String aParentUserRole) {
this.roleNamePerParentRoleName.put(aUserRole,aParentUserRole);
}
You can’t perform that action at this time.