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 class EmailUtility{ | |
| public Boolean sendEmail(String emailTo, String emailCC, String emailSubject, String emailBody){ | |
| //Flag to track whether email is sent successfully | |
| Boolean isSuccess = false; | |
| //Body of attachment in email. It can be replaced with standard sf attachment | |
| Blob body = Blob.valueOf('Sample Body for email attachment'); | |
| //Creating email attachmentattachment specifying content type and file name | |
| Messaging.EmailFileAttachment attach = new Messaging.EmailFileAttachment(); |
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="AutoCompleteController" ID="page" standardStylesheets="false" sidebar="false"> | |
| <apex:stylesheet value="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"/> | |
| <apex:stylesheet value="//code.jquery.com/ui/1.11.3/themes/sunny/jquery-ui.css"/> | |
| <apex:includeScript value="//code.jquery.com/jquery-1.10.2.js"/> | |
| <apex:includeScript value="//code.jquery.com/ui/1.11.3/jquery-ui.js"/> | |
| <apex:form id="form"> | |
| <div class="container"> | |
| <!-- we cannot bind jquery UI autocomplete directly to apex input fields. So it needs to be bind to some regular input field then on form submission, the values need to be copied to some hidden apex input field--> |
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 class AutoCompleteController { | |
| //String property to pass JSON data to page | |
| public String toEmailJSON{get;set;} | |
| //String property to save the values selected by user | |
| public String selectedEmails{get;set;} | |
| //Constructor of the class where email addresses are obtained from custom setting and converted to JSON | |
| public autocompleteController(){ | |
| Set<String> autocompleteEmailSet = AutocompleteEmails__c.getAll().keyset(); |
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
| //Creating push notification for new opportunities | |
| PushTopic pushTopic = new PushTopic(); | |
| pushTopic.Name = 'AllOpenOps'; | |
| pushTopic.Query = 'SELECT Id,Name,IsClosed,Amount,StageName,Probability FROM Opportunity'; | |
| pushTopic.ApiVersion = 33.0; | |
| pushTopic.NotifyForOperationCreate = true; | |
| pushTopic.NotifyForFields = 'Referenced'; | |
| insert pushTopic; |
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 standardStylesheets="false" controller="StreamingController" showHeader="TRUE" sidebar="false"> | |
| <link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" /> | |
| <div class="container"> | |
| <!--Displaying initial 10 opporunities in a table--> | |
| <table id="oppTable" class="table table-hover table-bordered table-striped"> | |
| <thead> | |
| <tr> | |
| <th> | |
| Name | |
| </th> |
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
| //This controller queries 10 opprotunities randomly | |
| public class StreamingController { | |
| public List<Opportunity> oppList{get;set;} | |
| public streamingController(){ | |
| oppList = [Select Id,Name,Amount,StageName FROM Opportunity limit 10]; | |
| } | |
| } |
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
| /*Hit login.salesforce.com or test.salesforce.com with username, password(+security token if required), customer ID and customer secret from connected app */ | |
| curl https://login.salesforce.com/services/oauth2/token -d 'grant_type=password&client_id=3MVG9Y6d_Btp4xp5OkM1b4zt4n4eqn2.VASD8jhibLV4goD.76u54WjIqaJwXtK29roDJfFFTTTTX0EO_f84q&client_secret=7894561272718739647&username=salesforcecodes@test.com&password=passwordValueSecurityToken' -H "X-PrettyPrint: 1" | |
| /* If username and password are correct, response will contain an access token, actual salesforce instace URL, expiry date etc. Please check below sample response. Make note of the access_token. This needs to be used in subsequent requests to get additional details */ | |
| { | |
| "access_token" : "00D90000000aEej!ERWEQGX7TSE6wu_6Nkwc18QX8S9875ZFxmB_GShktCO3F2nGQ_foZUc6584gbzahutSOlvMyee7UMNKXvdCFImJXJInYv1oD", | |
| "instance_url" : "https://ap1.salesforce.com", | |
| "id" : "https://login.salesforce.com/id/00D90000000aEejEAE/00590000000L8cPAAS", |
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
| /*Hit the instance URL obtained from login http call with access token for any REST operation after that*/ | |
| /### QUERYING SINGLE ACCOUNT USING REST API CALL ###/ | |
| /*REQUEST*/ | |
| curl https://ap1.salesforce.com/services/data/v28.0/query?q=SELECT+Id,+Name+FROM+Account+LIMIT+1 -H 'Authorization: OAuth 00D90000000aEej\!ERWEQGX7TSE6wu_6Nkwc18QX8S9875ZFxmB_GShktCO3F2nGQ_foZUc6584gbzahutSOlvMyee7UMNKXvdCFImJXJInYv1oD' -H 'X-PrettyPrint:1' | |
| /*RESPONSE*/ | |
| { | |
| "totalSize" : 1, |
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
| /***************************************************************************************************************** | |
| * Name : UTIL_ParentSetController | |
| * @author : #### | |
| * @date : 21/04/2016 | |
| * @group : Reusable class | |
| * @description : Virtual class with reusable methods using standardsetcontroller | |
| ******************************************************************************************************************/ | |
| public virtual class UTIL_ParentSetController { | |
| private ApexPages.StandardSetController controller; | |
| private String baseQuery; |
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
| /***************************************************************************************************************** | |
| * Name : AccountListController | |
| * @author : #### | |
| * @date : 21/04/2016 | |
| * @group : Controller | |
| * @description : Controller for page with pagination extending reusable utitlity class | |
| ******************************************************************************************************************/ | |
| public class AccountListController extends UTIL_ParentSetController { | |
| public AccountListController() { |