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 | |
private class TransactionTest{ | |
@isTest(seeAllData=true) | |
static void test(){ | |
String companyName = 'Company 1'; | |
c2g__codaCompany__c company = [SELECT id, name FROM c2g__codaCompany__c WHERE name = :companyName]; | |
User usr = new User(alias = 'standt', | |
email='[email protected]', |
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
Set<String> names = new Set<String>{'Me','Myself','I'}; | |
String query = 'SELECT id, name FROM User WHERE LastName IN :names'; | |
List<sObject> objs = Database.query(query); | |
System.debug(objs); |
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 Invoice_PostAction on c2g__codaInvoice__c (after insert, after update) { | |
List<c2g.CODAAPICommon.Reference> toPost = new List<c2g.CODAAPICommon.Reference>(); | |
for(c2g__codaInvoice__c document:Trigger.new){ | |
if( document.Action_PostDocument__c == true ){ | |
if(document.c2g__invoiceStatus__c != 'In Progress'){ | |
System.debug(LoggingLevel.Warn,'Cannot post invoice, invoice is '+document.c2g__invoiceStatus__c); | |
}else{ | |
c2g.CODAAPICommon.Reference ref = new c2g.CODAAPICommon.Reference(); | |
ref.id = document.id; | |
toPost.add(ref); |
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 | |
private class TestCumulative{ | |
@isTest | |
private static void cumulativeTest(){ | |
List<test_obj__c> objs = [select id from test_obj__c]; | |
for(integer i = 0; i < 99; i++){ | |
insert new test_obj__c(); | |
} | |
System.debug(LoggingLevel.Error,'Finished the loop. About to die.'); | |
objs = [select id from test_obj__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
Iterator<Schema.sObjectField> i = fields.iterator(); | |
while(i.hasNext()) | |
result += i.next() + i.hasNext() ? ',' :''; |
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
Show hidden characters
{ | |
// NOTE: You should always edit options in user file, not this file. | |
// Auto format on file save | |
"autoformat_on_save": false, | |
// Please visit http://astyle.sourceforge.net/astyle.html for more information | |
"options_default": { | |
// Default bracket style | |
// Can be either "allman", "ansi", "bsd", "break", "java", "attach", "kr", "k&r", |
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 MyControllerThing{ | |
@RemoteAction | |
public static MyWrapperThing getWrapper(){ | |
MyWrapperThing result = new MyWrapperThing(); | |
result.isSomething = true; | |
result.name = 'my wrapper obj'; | |
result.version = 7; | |
return result; | |
} | |
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
List<SObject> l = new List<Sobject>(); | |
l.addAll(new List<Contact>()); |
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
new Map<String,Object>{ | |
'isBooleanType' => true, | |
'integerType' => 42, | |
'strings' => 'are stringy', | |
'this is where it gets tripy' => new Map<String,Object>{ | |
'down the rabbit hole' => true, | |
'through the looking glass' => new Map<String,Object>{ | |
'isThisEnoughToGetThePointAcross' => true | |
} | |
}, |
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="Thingy"> | |
This blank canvas with our controller applied lets us invoke the remoting methods from the dev console via: | |
<ul> | |
<li><code>Thingy.regularLimits(function(response){console.log('Regular limits are:',response);});</code></li> | |
<li><code>Thingy.readOnlyLimits(function(response){console.log('Regular limits are:',response);});</code></li> | |
</ul> | |
</apex:page> |