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
/* | |
REQUIRES https://github.com/financialforcedev/apex-mdapi | |
Exports all instances of field-layout items into CSV format: | |
Object,Field,Layout,Behavior | |
"account","AccountNumber","account-account %28marketing%29 layout","Edit" | |
"account","AccountNumber","account-account %28sales%29 layout","Edit" | |
...... |
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
final String PAYLOAD_ORIGINAL = 'abc<123>def'; | |
final String PAYLOAD_ESCAPED = PAYLOAD_ORIGINAL.escapeXml(); | |
final String XML = '<foo><bar>' + PAYLOAD_ESCAPED + '</bar></foo>'; | |
//READER | |
String PAYLOAD_FROM_READER = ''; | |
final XmlStreamReader reader = new XmlStreamReader(XML); | |
for(Integer i=0; i<2; i++) reader.next(); | |
for(Integer i=0; i<5; i++){ | |
reader.next(); |
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
# REPLACE THE FOLLOWING VALUES | |
USERNAME=XXXXXXXXXXXXXXXXX | |
PASSWORD=XXXXXXXXXXXXXXXXX | |
# LOGIN | |
curl https://login.salesforce.com/services/Soap/u/31.0 -H "Content-Type: text/xml; charset=UTF-8" -H "SOAPAction: login" -d "<Envelope xmlns=\""http://schemas.xmlsoap.org/soap/envelope/\""><Header/><Body><login xmlns=\""urn:partner.soap.sforce.com\""><username>$USERNAME</username><password>$PASSWORD</password></login></Body></Envelope>" | |
# INSPECT RESPONSE AND SET FOLLOWING VALUES | |
# DOMAIN SHOULD BE na1, acme.my, etc | |
DOMAIN=na1 |
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
final String NEW_FREQ_FOR_ALL_GROUP_MEMBERS = 'P'; //P=>On each post, D=>Daily, W=>Weekly, N=>Never | |
final String GROUP_ID = 'CHANGE_ME'; //select id,name from CollaborationGroup | |
final List<CollaborationGroupMember> members = [ | |
select id, NotificationFrequency | |
from CollaborationGroupMember | |
where CollaborationGroupID = :GROUP_ID | |
and NotificationFrequency != :NEW_FREQ_FOR_ALL_GROUP_MEMBERS | |
]; | |
if(members != null && members.size() > 0){ |
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 docType="html-5.0" sidebar="false" showHeader="false" | |
standardStylesheets="false" cache="true"> | |
<!-- TRANSFORM PARTNER URL INTO TRUE PROXY URL --> | |
<apex:variable var="PARTNER_URL" value="{!$Api.Partner_Server_URL_290}" /> | |
<apex:variable var="PARTNER_URL_SPLIT" value="{! | |
LEFT(PARTNER_URL,FIND('.visual.force.com',PARTNER_URL)-1) | |
}"/> | |
<apex:variable var="POD" value="{! | |
MID(PARTNER_URL_SPLIT,FIND('.',PARTNER_URL_SPLIT)+1,LEN(PARTNER_URL_SPLIT)) |
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 QuickTest implements Schedulable, Database.Batchable<SObject>{ | |
//schedule hooks | |
global void execute(SchedulableContext sc){ Database.executeBatch(this); } | |
//batch hooks | |
global Database.QueryLocator start(Database.BatchableContext context){ | |
return Database.getQueryLocator([select id from account]); | |
} | |
global void execute(Database.BatchableContext context, List<SObject> records){ System.debug('ola'); } |
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
/* | |
====================================================================== | |
The following apex code demonstrates logging into another salesforce | |
org via the SOAP/XML web service api and then using session id to | |
query the standard REST API as well as the Chatter REST API. | |
To run this code, simply copy and paste into execute anonymous, | |
then replace the value of the first three variables accordingly. | |
NOTES: | |
(1) You'll need to create a remote site setting for both the login |
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
SELECT name FROM account WHERE employees < 10 |