This file contains hidden or 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
| /* | |
| In the Programmers workbook there is a tutorial on creating a basic REST endpoint using Apex. A common scenario with these | |
| endpoints is needing to enhance the message that gets sent down to client. You can do this easily within Apex by defining | |
| a custom class to use as a response, which will be converted to JSON by the platform. | |
| To complete this extra credit: | |
| 1. Create a class from the code below | |
| 2. Update the POST and DELETE endpoints to use the RESTMessage class | |
| 3. Test the new endpoint with unit test in the next class | |
| */ |
This file contains hidden or 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
| /** | |
| After insert handler on task Sobject | |
| */ | |
| public class TaskAfterInsertHandler implements Triggers.Handler { | |
| public void handle() { | |
| System.debug(LoggingLevel.INFO, 'Post insert handling ' + Trigger.new ); | |
| } | |
| } |
This file contains hidden or 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
| public with sharing class ChatterUtils { | |
| // makes a simple chatter text post to the specified user from the running user | |
| public static void simpleTextPost(Id userId, String postText) { | |
| ConnectApi.FeedType feedType = ConnectApi.FeedType.UserProfile; | |
| ConnectApi.MessageBodyInput messageInput = new ConnectApi.MessageBodyInput(); | |
| messageInput.messageSegments = new List<ConnectApi.MessageSegmentInput>(); | |
This file contains hidden or 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
| public with sharing class AccountController | |
| { | |
| @AuraEnabled | |
| public static List<Account> GetAccountNames() | |
| { | |
| return [select id, Name from Account limit 10]; | |
| } | |
| @AuraEnabled | |
| public static List<Account> GetAccountDetails(String idListJSONStr) |
This file contains hidden or 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
| /** | |
| * @ApexClass : SFCompareController | |
| * @Description : This provides services to SFCompare page, which can be accessed by js remoting. It provides below services. | |
| * 1. Logging into SF orgs for obtaining session and instance url. | |
| * 2. Fetches code from the SF org. | |
| * */ | |
| public class SFCompareController { | |
| /** | |
| * @description : This method does the login to sf orgs and provides session id and |
This file contains hidden or 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
| Gist of Centralized Async Handling via Queueable Apex | |
| For accompanying presentation see http://scottbcovert.github.io/queueable-apex | |
| NOTE: The following source alone will not compile as it is one piece of a larger Force.com development framework available at https://github.com/scottbcovert/Centralized-Salesforce-Dev-Framework |
This file contains hidden or 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 controller="CustomSettingController"> | |
| <apex:pageMessages id="msgs" /> | |
| <apex:form id="theform"> | |
| <apex:inputField value="{!cs.Field1__c}" /> | |
| <apex:inputField value="{!cs.Field2__c}" /> | |
| <apex:commandButton value="{!$Label.CSTab_Save}" action="{!update}" rerender="msgs,theform" /> | |
| </apex:form> | |
| </apex:page> |
This file contains hidden or 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
| /** | |
| * P2_BatchProcessController | |
| * @description VF controller class for a VF tab | |
| * allowing user to select a batch / schedule apex job | |
| * and execute it immediately | |
| * @author dancinllama | |
| * @date 4/17/2012 | |
| */ | |
| public class P2_BatchProcessController { | |
This file contains hidden or 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
| toolingSoapSForceCom.SessionHeader_element sessionEl = new toolingSoapSForceCom.SessionHeader_element(); | |
| sessionEl.sessionId = UserInfo.getSessionId(); | |
| toolingSoapSForceCom.SforceService service = new toolingSoapSForceCom.SforceService(); | |
| service.SessionHeader = sessionEl; | |
| //service.endpoint_x = //Adjust this to your endpoint, if needed... | |
| toolingSoapSForceCom.ApexCodeCoverageAggregateQueryResult queryResult = service.queryApexCodeCoverageAggregate('Select NumLinesCovered From ApexCodeCoverageAggregate'); | |
| System.debug(queryResult); |
This file contains hidden or 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 Simple invocable class (can be called via process or flow). For logging a message or messages to the debug logs. | |
| * @author James Loghry | |
| * @date 8/1/2016 | |
| */ | |
| public class InvocableLogger { | |
| @InvocableMethod | |
| public static void log(List<String> messages){ | |
| if(messages != null){ | |
| for(String message : messages){ |
NewerOlder