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
//NewProj2 isn't a meaningful Apex name. NewProjectTrigger? | |
trigger NewProj2 on Opportunity (before update) { | |
for (Opportunity o : Trigger.new) | |
{ | |
if(o.StageName == 'Closed Won') | |
{ | |
try | |
{ | |
SFL5_Projects__c[] proj = [Select Name From SFL5_Projects__c |
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 OpportunitiesController { | |
public List<Opportunity> opportunities {get; set;} | |
public OpportunitiesController() { | |
opportunities = [SELECT Id, Name, Account.Name, ExpectedRevenue, CloseDate from Opportunity WHERE OwnerId = :UserInfo.getUserId()]; | |
} | |
} |
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 with sharing class FlickrHandler { | |
public class FlickrList { | |
public string title {get; set;} | |
public string link {get; set;} | |
public List<FlickrData> items {get; set;} | |
} | |
public class FlickrData { | |
public string title {get; set;} |
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 BlogLog_Services implements Messaging.InboundEmailHandler { | |
public BlogLog_Services() {} | |
public Document document { | |
get { | |
if (document == null) | |
document = new Document(); | |
return document; | |
} |
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
/* | |
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 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
/* Various features of the Salesforce1 platform require Apex to utilize specific interfaces so the a level of | |
functionality can be assumed. One of these is the inbound email interface. This allows Apex to be used as an | |
email service which can process incoming emails. | |
To complete this extra credit: | |
1. Create an Apex class that uses the Inbound Email interface using the code below | |
2. Complete the acceptEmail function so that it returns an email with more information on the product | |
3. Add the Apex class as an email service and test it manually. | |
*/ |
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 Streaming API allows clients to get updates on data changes in near real-time. | |
This is done by keeping an open connection instead repeatedly polling the server, which is much more lightweight. | |
To accomplish this connection, you need a cometD capable client. Luckily, there is a jQuery plugin for this - | |
which makes jQuery in Visualforce an easy way to test out the API. | |
To complete this extra credit: | |
1. Create a Streaming Topic with the following code. | |
2. Include jQuery, the cometD and iCanHas libraries in a Visualforce page. | |
3. Add the necessary JavaScript to connect to the Streaming API |
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
/* | |
This is an Apex class which calls out to an endpoint to find new merchandise items to be inserted into the system. | |
Before it can be deployed to production, however, it needs a unit test. Since it makes an HTTP callout, however, | |
the unit test will require a mock class. | |
Before you can test the class, you will also need to open a Remote Site to let your Salesforce instance know | |
it is a legitimate site: | |
1. Go to Setup | System Administration | Security Controls | Remote Site Settings. | |
2. Click New. |
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 standardController="Invoice__c" extensions="LineItemRemotingExtension" showHeader="false"> | |
<apex:stylesheet value="{!URLFOR($Resource.OneStarter,'icons.css')}"/> | |
<apex:stylesheet value="{!URLFOR($Resource.OneStarter,'styles.css')}"/> | |
<apex:stylesheet value="{!URLFOR($Resource.OneStarter,'OneStarter.css')}"/> | |
<apex:includeScript value="//code.jquery.com/jquery-1.10.2.min.js" /> | |
<apex:includeScript value="{!URLFOR($Resource.TouchSwipe,'jquery.touchSwipe.min.js')}"/> | |
<apex:includeScript value="{!URLFOR($Resource.OneStarter,'jquery.onestarter.js')}"/> | |
<apex:includeScript value="/canvas/sdk/js/publisher.js"/> |
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 with sharing class ListDetailController { | |
public List<Account> accounts {get; set;} | |
public Account account_detail {get; set;} | |
public Id account_id {get; set;} | |
public Boolean showBack {get; set;} | |
// The extension constructor initializes the private member | |
// variable mysObject by using the getRecord method from the standard | |
// controller. |