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:pageBlockSection columns="1"> | |
<apex:repeat value="{!$ObjectType.Incident__c.FieldSets.PortalNewLower}" var="field"> | |
<apex:pageBlockSectionItem helpText="{!$ObjectType.Incident__c.Fields[field].InlinehelpText}"> | |
<apex:outputLabel value="{!field.label}" /> | |
<apex:inputField value="{!newIncident[field]}" required="{!field.required || field.DBRequired}" style="width:65%" /> | |
</apex:pageBlockSectionItem> | |
</apex:repeat> | |
</apex:pageBlockSection> |
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="SomeObject__c" extensions="TagDemoController"> | |
<apex:form> | |
<apex:pageBlock> | |
<apex:pageBlockButtons> | |
<apex:commandButton action="{!save}" value="Save" /> | |
</apex:pageBlockButtons> | |
Select a document: <apex:inputField value="{!documentSelector.itemId}" /> | |
</apex:pageBlock> | |
</apex:form> | |
</apex:page> |
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 TagDemoController { | |
Public ApexPages.StandardController sc {get; set;} | |
public DocumentTag documentSelector {get; set;} | |
public TagDemoController(ApexPages.StandardController sc){ | |
this.sc = sc; | |
documentSelector = new DocumentTag(); //Initialize our tag to avoid a null pointer | |
} | |
public PageReference save(){ |
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 CountIncidents on itil_b__Incident__c (after insert, after update){ | |
List<Id> AccountIDs = itil_b.Util.getIDFields(Trigger.new,'itil_b__account__c'); | |
List<AggregateResult> totalIncidents = [SELECT itil_b__Account__c, COUNT(Id) | |
FROM itil_b__Incident__c WHERE itil_b__Account__c IN :AccountIDs AND itil_b__Account__c != null | |
GROUP BY ROLLUP(itil_b__Account__c)]; | |
Map<id,Account> accounts = new Map<id,Account>([SELECT total_incidents__c, id FROM Account WHERE Id IN :accountIDs]); | |
for(AggregateResult ar: totalIncidents){ |
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
Id someId = [SELECT id FROM Contact LIMIT 1].Id; | |
String ruinedCase = ((String)someId).toLowerCase(); | |
Id fixedCase = Id.valueOf(ruinedCase); | |
System.assertEquals( | |
String.valueOf(someId).subString(0,15), | |
String.valueOf(fixedCase).substring(0,15) | |
); //fails, for me: System.AssertException: Assertion Failed: Expected: 003i000002O2aZG, Actual: 003i000002o2azg |
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
Account a = [SELECT id, name, description FROM Account LIMIT 1]; | |
a.description = 'This code with person accounts on is like playing russion roulete'; | |
update a; //DMLException if you got a person account, works otherwise |
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 OhGodBees extends Exception{} | |
//fails: OhGodBees: Classes extending Exception must have a name ending in 'Exception' |
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
#!/usr/bin/env python | |
import os, sys, re | |
from os import curdir, sep | |
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer | |
class MyHandler(BaseHTTPRequestHandler): | |
def do_GET(self): | |
try: |
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
Account a1 = new Account(name = 'woop'); | |
Account a2 = new Account(name = 'woop'); | |
System.debug( a1 == a2 ); //true | |
System.debug( a1 === a2 ); //false |
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 MY_NAMESPACE_PREFIX = 'ns__'; | |
String cleanedJSON = JSON.serialize(subject); | |
cleanedJSON = cleanedJSON.replaceAll('"'+MY_NAMESPACE_PREFIX+'([a-zA-Z0-9_-]+":)', '"$1'); |
NewerOlder