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
//Sample code for Hybrid REST Explorer | |
function regLinkClickHandlers() { | |
// avoid jQuery conflicts | |
var $j = jQuery.noConflict(); | |
// standard logout function | |
$j('#link_logout').click(function() { | |
SFHybridApp.logToConsole("link_logout clicked"); | |
SalesforceOAuthPlugin.logout(); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" /> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> | |
<!-- include jquery mobile --> | |
<link rel="stylesheet" href="jquery/jquery.mobile-1.0b2.min.css" /> | |
<script src="jquery/jquery-1.6.2.min.js"></script> | |
<script src="jquery/jquery.mobile-1.0b2.min.js"></script> |
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 InvoiceUtilities { | |
// class method to renumber Line Items for a given Invoice number | |
// returns a string that indicates success or failure | |
public static String renumberLineItems(String invoiceName) { | |
// create a copy of the target Invoice object and it's Line Items | |
// loop through each Line Item, renumbering as you go |
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 InvoiceUtilities { | |
// class method to renumber Line Items for a given Invoice number | |
// returns a string that indicates success or failure | |
public static String renumberLineItems(String invoiceName) { | |
// create a copy of the target Invoice object and it's Line Items | |
Invoice__c invoice = [Select i.Name, (Select Name From Line_Items__r ORDER BY Name) | |
From Invoice__c i | |
Where i.Name = :invoiceName LIMIT 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
public class InvoiceUtilities { | |
// class method to renumber Line Items for a given Invoice number | |
// returns a string that indicates success or failure | |
public static String renumberLineItems(String invoiceName) { | |
// create a copy of the target Invoice object and it's Line Items | |
Invoice__c invoice = [Select i.Name, (Select Name From Line_Items__r ORDER BY Name) | |
From Invoice__c i | |
Where i.Name = :invoiceName LIMIT 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
public class InvoiceUtilities { | |
// class method to renumber Line Items for a given Invoice number | |
// returns a string that indicates success or failure | |
public static String renumberLineItems(String invoiceName) { | |
// create a copy of the target Invoice object and it's Line Items | |
Invoice__c invoice = [Select i.Name, (Select Name From Line_Items__r ORDER BY Name) | |
From Invoice__c i | |
Where i.Name = :invoiceName LIMIT 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
global with sharing class InvoiceUtilities { | |
// class method to renumber Line Items for a given Invoice number | |
// returns a string that indicates success or failure | |
webservice static String renumberLineItems(String invoiceName) { | |
// create a copy of the target Invoice object and it's Line Items | |
Invoice__c invoice = [Select i.Name, (Select Name From Line_Items__r ORDER BY Name) | |
From Invoice__c i | |
Where i.Name = :invoiceName LIMIT 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
trigger DeleteRestrictInvoice on Invoice__c (before delete) { | |
// create a list of Invoices in Trigger.oldMap along with their Line Items | |
List<Invoice__c> invoices = [Select i.Name, (Select Name From Line_Items__r) | |
From Invoice__c i | |
Where i.Id IN :Trigger.oldMap.keySet()]; | |
// loop through the Invoices, attaching errors to those that have Line Items | |
for (Invoice__c invoice : invoices) { | |
if (!invoice.Line_Items__r.isEmpty()) { |
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
@isTest | |
private class TestDeleteRestrictInvoice { | |
// Invoice generator, with or without a Line Item | |
static Invoice__c createNewInvoice(Boolean withLineItem) { | |
// Create test Invoice and insert it into the database | |
Invoice__c invoice = new Invoice__c(); | |
insert invoice; | |
// Create test Line Item and insert it into the database, if withLineItem == true |
OlderNewer