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
// Get the field describe result for the Name field on the Account object | |
Schema.DescribeFieldResult dfr = Schema.sObjectType.Account.fields.Name; |
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
// Create a new account as the generic type sObject | |
sObject s = new Account(); | |
// Verify that the generic sObject is an Account sObject | |
System.assert(s.getsObjectType() == Account.sObjectType); | |
// Get the sObject describe result for the Account object | |
Schema.DescribeSObjectResult dsr = Account.sObjectType.getDescribe(); |
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
/** | |
* @Description: This method returns a list of FieldSetMember as per the Object and Field Set Name | |
* @Arguments: NA | |
* @Return: List<Schema.FieldSetMember> | |
**/ | |
private List<Schema.FieldSetMember> getFields() { | |
/** @Description: Account is the object and FieldSetName is the API Name of the FieldSet **/ | |
return SObjectType.Account.FieldSets.FieldSetName.getFields(); | |
} |
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
/** | |
* @Description: This method takes in a list of Contacts as parameteres and creates individual lists for user fields | |
* @Arguments: List<String> | |
* @Return: void | |
**/ | |
static void createCommunityUsers(List<Contact> contactList){ | |
/** @Description: List variables to store user information.**/ | |
List<String> str_contId = new List<String>(); | |
List<String> str_alias = new List<String>(); |
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
//instantiate a new Contact | |
Contact con = new Contact(); | |
con.LastName = 'testLastName'; | |
con.Email = 'test101@salesforce.com'; | |
//getch recordtypeId via schema call, recordtype should be referenced by Name and not Developer Name | |
con.RecordTypeId = Schema.SObjectType.Contact.RecordTypeInfosByName.get('Contact Record Type').RecordTypeId; | |
Database.insert(con); |
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
//Fetch the Profile Id that will assigned to the user | |
List<Profile> profileList = [SELECT Id FROM Profile WHERE Name='Standard User']; | |
//Instantiate a user variable | |
User testUser = new User(); | |
//if profilelist is not empty | |
if(!profileList.isEmpty()){ | |
//Create user | |
testUser = new User(Alias = 'standt', Email='standarduser@testorg.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
//Create a Map of roleId to User Ids | |
Map<Id, List<Id>> userRoleToUsersMap = new Map<Id, List<Id>>(); | |
//SOQL to query and loop over all the users | |
for(User newUser : [SELECT UserRoleId FROM User LIMIT 50000]) { | |
//if userRoleToUsersMap already contains roleId | |
if(userRoleToUsersMap.containsKey(newUser.UserRoleId)) { | |
//fetch all the existing user ids for a roleId in a list | |
List<Id> usersId = userRoleToUsersMap.get(newUser.UserRoleId); | |
usersId.add(newUser.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
<?xml version="1.0" encoding="UTF-8"?> | |
<Package xmlns="http://soap.sforce.com/2006/04/metadata"> | |
<types> | |
<members>*</members> | |
<name>ApexClass</name> | |
</types> | |
<types> | |
<members>*</members> | |
<name>ApexTrigger</name> | |
</types> |
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
<apex:page showHeader="false" standardStylesheets="false" sidebar="false" applyHtmlTag="false" applyBodyTag="false" docType="html-5.0"> | |
<html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> | |
<head> | |
<title>Salesforce Lightning Design System Trailhead Module</title> | |
<!-- Make sure to update the Static Resource Name as per the static resource's name in your org --> | |
<apex:stylesheet value="{!URLFOR($Resource.REPLACE_WITH_NAME_OF_SLDS_STATIC_RESOURCE, 'assets/styles/salesforce-lightning-design-system-vf.css')}" /> | |
</head> |
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
<apex:page showHeader="false" standardStylesheets="false" sidebar="false" applyHtmlTag="false" applyBodyTag="false" docType="html-5.0"> | |
<html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> | |
<head> | |
<title>Salesforce Lightning Design System Trailhead Module</title> | |
<!-- Make sure to update the Static Resource Name as per the static resource's name in your org --> | |
<apex:stylesheet value="{!URLFOR($Resource.REPLACE_WITH_NAME_OF_SLDS_STATIC_RESOURCE, 'assets/styles/salesforce-lightning-design-system-vf.css')}" /> | |
</head> |
NewerOlder