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 CRMCasesConsoleController { | |
private ApexPages.StandardSetController controller; | |
public List<Case> cases { | |
get { return controller.getRecords(); } | |
} | |
public Integer page { | |
get { return controller.getPageNumber(); } |
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
/** | |
* Developed by Doug Ayers (douglascayers.com) | |
*/ | |
public with sharing class DuplicateRecordUtils { | |
public static Set<ID> getDuplicateRecordIds( ID recordId ) { | |
Set<ID> duplicateRecordIds = new Set<ID>(); | |
// Potential duplicate records are grouped together into 'duplicate record sets'. |
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
/** | |
* Simple service to make http callout to Bitly url shortener service. | |
*/ | |
public class BitlyService { | |
/** | |
* Given a long URL will return the shortened version. | |
* https://dev.bitly.com/api-reference#createBitlink | |
*/ | |
public String shorten(String url) { | |
HttpRequest req = new HttpRequest(); |
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 BitlyShortenURLInvocable { | |
@InvocableMethod( | |
label = 'shorten' | |
description = 'Given case IDs then generates a bitly short url for them' | |
) | |
public static void shorten(List<ID> caseIds) { | |
// You can't invoke http callouts from Process Builder or Flow | |
// because the database transaction has not committed yet, you will get error: | |
// "System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out" |
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
trigger CampaignTrigger on Campaign ( before insert ) { | |
List<Campaign> campaigns = Trigger.new; | |
Set<ID> clonedCampaignIds = new Set<ID>(); | |
for ( Campaign campaign : campaigns ) { | |
if ( campaign.isClone() ) { | |
clonedCampaignIds.add( campaign.getCloneSourceId() ); |
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 > | |
<!-- good ol' jquery! --> | |
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script> | |
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script> | |
<script>$j = jQuery.noConflict();</script> | |
<!-- the infamous SLDS, aka my nemesis --> | |
<apex:stylesheet value="{!URLFOR($Resource.SLDS0121,'assets/styles/salesforce-lightning-design-system-vf.css')}"/> |
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
@IsTest | |
public class BitlyHttpCalloutMock implements HttpCalloutMock { | |
public HttpResponse respond(HttpRequest req) { | |
String endpoint = req.getEndpoint(); | |
if ( endpoint.contains('/oauth/access_token') ) { | |
return buildOAuthResponse( req ); | |
} else if ( endpoint.contains('/v4/shorten') ) { |
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>Flow</name> | |
</types> | |
<types> | |
<members>*</members> | |
<name>FlowDefinition</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
public class RedirectApexController { | |
public RedirectApexController( ApexPages.StandardController stdController ) {} | |
public PageReference redirect() { | |
// ... do some logic to determine where to redirect to ... | |
PageReference page = new PageReference('/apex/MyPage'); | |
// pass any parameters that came in on request on to the final destination |
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
/** | |
* https://twitter.com/Joy_SH/status/738087166547398656 | |
* https://help.salesforce.com/apex/HTViewSolution?id=000175908&language=en_US | |
*/ | |
public with sharing class LeadConvertedViewController { | |
public Lead record { get; private set; } | |
public LeadConvertedViewController( ApexPages.StandardController stdController ) { | |
this.record = (Lead) queryRecord( stdController.getId() ); |