Related Setup: https://gist.github.com/hofmannsven/6814278
Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/
/* | |
* @description: this class extends the standard opportunity object providing an action which attachs the PDF as an attachment against the opportunity | |
* | |
* @TODO's: | |
*/ | |
public class PrintExtension{ | |
// Create standard object controller |
/* | |
@description: Controller Extension used by Flow | |
@date: 13th April 2015 | |
@author: Salesforce Weekly | |
*/ | |
public class ClosedLoopMarketingFlowExtension { | |
private final Contact cont; | |
private PageReference pageRef; |
<apex:page standardController="Contact" extensions="ClosedLoopMarketingFlowExtension" > | |
<flow:interview name="Closed_Loop_Marketing_Demo_Part_1" | |
interview="{!myFlow}" | |
finishLocation="{!FinishLocation}"> | |
<apex:param name="varContactId" value="{!Contact.Id}"/> | |
</flow:interview> | |
</apex:page> | |
public class AutocompleteController { | |
@AuraEnabled | |
public static List<sObject> getSuggestions(String sObjectType, String term, String fieldsToGet, Integer limitSize) { | |
// could add in logic to remove possible duplicate fields | |
String fields = fieldsToGet.length() > 0 ? ',' + fieldsToGet : ''; | |
String soql = | |
' SELECT Name, Id ' + String.escapeSingleQuotes(fields) + | |
' FROM ' + String.escapeSingleQuotes(sObjectType) + | |
' WHERE Name Like \'' + String.escapeSingleQuotes(term) + '%\'' + |
Related Setup: https://gist.github.com/hofmannsven/6814278
Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/
global class XmlToJson { | |
// Try to determine some data types by pattern | |
static Pattern | |
boolPat = Pattern.compile('^(true|false)$'), decPat = Pattern.compile('^[-+]?\\d+(\\.\\d+)?$'), | |
datePat = Pattern.compile('^\\d{4}.\\d{2}.\\d{2}$'), | |
timePat = Pattern.compile('^\\d{4}.\\d{2}.\\d{2} (\\d{2}:\\d{2}:\\d{2} ([-+]\\d{2}:\\d{2})?)?$'); | |
// Primary function to decode XML | |
static Map<Object, Object> parseNode(Dom.XmlNode node, Map<Object, Object> parent) { | |
// Iterate over all child elements for a given node | |
for(Dom.XmlNode child: node.getChildElements()) { |
for ( Sobject sobj : someList ){ | |
Map<Id, SObject> innerMap = mainMap.containsKey( sobj.outer ) | |
? mainMap.get( sobj.outerId ) : new Map<Id, SObject>(); | |
innerMap.put( sobj.innerId, sobj ); | |
mainMap.put( sobj.outerId, innerMap ); | |
} |
<?xml version="1.0" encoding="UTF-8"?> | |
<Package xmlns="http://soap.sforce.com/2006/04/metadata"> | |
<version>42.0</version> | |
</Package> |
for(Schema.SobjectField strFld: Loan_New__c.SobjectType.getDescribe().fields.getMap().Values()) | |
{ | |
if(strFld.getDescribe().getType() == Schema.DisplayType.REFERENCE) | |
{ | |
system.debug('object:'+strFld.getDescribe().getReferenceTo()); | |
} | |
} | |
Schema.DescribeSObjectResult R = Loan_New__c.SObjectType.getDescribe(); | |
for (Schema.ChildRelationship cr: R.getChildRelationships()) |
{ | |
"nonBorrowingResidents": [ | |
{ | |
"relationship_to_client": "Uncle", | |
"name": "NBR-38", | |
"monthly_income": 456345.00, | |
"date_of_birth": "1923-03-01", | |
"non_borrowing_resident_name": "fgh", | |
"loan_id": "a0Q29000002ooRuEAI", | |
"last_modified_by_id": "00529000001A6eCAAS", |