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
@RestResource(urlMapping='/Accounts/*/contacts') | |
global with sharing class AccountManager { | |
@HttpGet | |
global static account getAccount() { | |
RestRequest request = RestContext.request; | |
String accountId = request.requestURI.substring(request.requestURI.lastIndexOf('/')-18, |
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
public class ocrv1 { | |
//read file contents, sent to http://www.ocrwebservice.com/api/restguide and get ocr response | |
public static void func1() { | |
StaticResource sr = [SELECT Id, name, Body FROM StaticResource where name = 'Simple_Survey_Intro' LIMIT 1]; | |
String b64String = EncodingUtil.base64Encode(sr.Body); | |
String hexString = EncodingUtil.convertToHex(sr.Body); | |
system.debug('\n b64= '+b64String +'\n hex= '+hexString); | |
Http http = new Http(); |
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
public class AccountProcessor { | |
@future | |
public static void countContacts(List<Id> accountId_lst) { | |
Map<Id,Integer> account_cno = new Map<Id,Integer>(); | |
List<account> account_lst_all = new List<account>([select id, (select id from contacts) from account]); | |
for(account a:account_lst_all) { | |
account_cno.put(a.id,a.contacts.size()); //populate the map | |
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
public class AnimalLocator { | |
public class cls_animal { | |
public Integer id; | |
public String name; | |
public String eats; | |
public String says; | |
} | |
public class JSONOutput{ | |
public cls_animal animal; |
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 controller="oauthv2Controller"> | |
<apex:form > | |
<apex:actionFunction name="getInfo" action="{!info}" /> | |
<apex:commandButton value="Get info" action="{!info}"/> <br/> | |
</apex:form> | |
<script> | |
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
global class batchclass1 implements Database.Batchable<sobject>,Database.Stateful { | |
global integer count = 0; | |
global Database.QueryLocator start(Database.BatchableContext bc) { | |
return Database.getQueryLocator('select id,name from account'); | |
} | |
global void execute(Database.BatchableContext bc,List<account> acc_lst) { | |
List<account> acc_update_lst = new List<account>(); | |
for(account a: acc_lst) { |
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
global class LeadProcessor implements Database.Batchable<sObject> { | |
global Integer count = 0; | |
global Database.QueryLocator start (Database.BatchableContext bc) { | |
return Database.getQueryLocator('Select Id, LeadSource from lead'); | |
} | |
global void execute (Database.BatchableContext bc,List<Lead> l_lst) { | |
List<lead> l_lst_new = new List<lead>(); | |
for(lead l : l_lst) { |
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 controller="importDataFromCSVController_mann"> | |
<apex:form > | |
<apex:pagemessages /> | |
<apex:pageBlock > | |
<apex:pageBlockSection columns="4"> | |
<apex:inputFile value="{!csvFileBody}" filename="{!csvAsString}"/> | |
<apex:commandButton value="Import Account" action="{!importCSVFile}"/> | |
</apex:pageBlockSection> | |
</apex:pageBlock> | |
<apex:pageBlock > |
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
public class AddPrimaryContact implements Queueable { | |
public contact c; | |
public String state; | |
public AddPrimaryContact(Contact c, String state) { | |
this.c = c; | |
this.state = state; | |
} | |
public void execute(QueueableContext qc) { |
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
public class DailyLeadProcessor implements schedulable{ | |
public void execute(schedulableContext sc) { | |
List<lead> l_lst_new = new List<lead>(); | |
List<lead> l_lst = new List<lead>([select id, leadsource from lead where leadsource = null]); | |
for(lead l : l_lst) { | |
l.leadsource = 'Dreamforce'; | |
l_lst_new.add(l); | |
} | |
update l_lst_new; |
OlderNewer