Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Szandor72's full-sized avatar

Christian Szandor Knapp Szandor72

View GitHub Profile
@Szandor72
Szandor72 / basic VF Extension template
Created May 24, 2017 17:18
basic VF Extension template
public with sharing class AccountExtensionController
{
private ApexPages.StandardController standardController;
public AccountExtensionController(ApexPages.StandardController standardController)
{
this.standardController = standardController;
}
public void nextStep(){
@istest(seealldata=true)
public class testLEXProfileForQuote {
    @istest
    public static void test() {
        String quoteId = 'a0O9E000000WDDf';
        User myUser = [select id, name from user where ProfileId = '00e9E000000HlA4' and lastname = 'Brückner' and isactive=true limit 1];
        sf42_quotefx__Sf42_quote__c quote = null;
        system.debug(myUser);
        System.runAs(myUser){
            quote = [ Select
@Szandor72
Szandor72 / ps1
Last active October 3, 2017 13:24
ForceCode: Generate and set Credentials for Scratch Orgs (Powershell)
sfdx force:user:password:generate
$myOrg = (sfdx force:org:display --json | ConvertFrom-Json).result
$forceConfig = Get-Content .\force.json -Raw | ConvertFrom-Json
$forceConfig.url = $myOrg.instanceUrl
$forceConfig.username = $myOrg.username
$forceConfig.password = $myOrg.password
$forceConfig.apiVersion = "40.0"
$forceConfig | ConvertTo-Json | Out-File -FilePath force.json -Encoding utf8
@Szandor72
Szandor72 / js
Created July 14, 2017 12:44
diff javascript
Array.prototype.rotate = function(n){
var len = this.length,
res = new Array(this.length);
if (n % len === 0) return this.slice();
else for (var i = 0; i < len; i++) res[i] = this[(i + (len + n % len)) % len];
return res;
};
String.prototype.diff = function(s,p){ // p -> precision factor
@Szandor72
Szandor72 / README.md
Created August 10, 2017 11:54 — forked from mattandneil/build.xml
Salesforce Organization Destroy - Ant Script

Salesforce Organization Destroy - Ant Script

This script searches and destroys (most) metadata in an organization. Use cases include ISV package development and testing within Developer Edition and Sandbox environments.

Usage: (paste the macrodef XML into your build file)

<target name="destroy">
    <destroy
 username="${sf.username}"
@Szandor72
Szandor72 / findDupes
Created October 25, 2017 14:37 — forked from goravseth/findDupes
invocable apex to find duplicate contacts using the new findDuplicates apex stuff
public class Flow_FindDupes {
//https://developer.salesforce.com/forums/?id=906F0000000AzDeIAK
@InvocableMethod(label='Get Dupes' description='Returns something')
public static List<Contact> getDuplicateContacts(List<Contact> contacts) {
system.debug('contacts size = ' + contacts.size());
list<sObject> dasContacts = new list<sobject>();
dasContacts.addall((List<sObject>)(contacts));
list<Contact> duplicateContacts = new list<Contact>();
List<String> sObjectNames = new String[]{'Account','Contact','opportunity'};
List<sObject> queriedObjects = new List<Sobject>();
For (String sObjectName : sObjectNames) {
//Querying for objects in a loop is bad practice
sObject tempObject = Database.query('Select Id, Name From ' + sObjectName + ' Limit 1');
queriedObjects.add(tempObject);
}
// .... //
myObject__c myObject = new myObject__c();
myObject.field1__c = 'abc';
myObject.field2__c = 'def';
List<String> objFields = new List<String> {'field1__c', 'field2__c'}
@Szandor72
Szandor72 / exception
Created February 24, 2018 21:22
Codec Error on deploy
2018-02-24 22:16:41: Running task: deploy
2018-02-24 22:16:41: Options:
2018-02-24 22:16:41: path: src
2018-02-24 22:16:41: Beginning task: Deploy
2018-02-24 22:16:41:
2018-02-24 22:16:42: Cleaning meta.xml files of packageVersion elements for deploy
2018-02-24 22:16:42: Task failed: deploy
2018-02-24 22:16:42: Failing flow due to exception in task
Traceback (most recent call last):
File "/root/virutalenvironments/cumulusci/local/lib/python2.7/site-packages/cumulusci/core/flows.py", line 191, in _run_task
C:\Users\szand\OneDrive\dev\mediavelox [master ↑]> sfdx force:source:status -r -u mvx
=== Source Status
STATE FULL NAME TYPE PROJECT PATH
────────────── ──────────────────────────────────────────────── ─────────────────────── ──────────────────────────────────────────────────────────────────────────────────────────────────────
Remote Changed DispoBlockedItems__c.AdPos_Catalog__c CustomField mediavelox\main\default\objects\DispoBlockedItems__c\fields\AdPos_Catalog__c.field-meta.xml
Remote Changed DispoBlockedItems__c.DispoBookEntry__c CustomField mediavelox\main\default\objects\DispoBlockedItems__c\fields\DispoBookEntry__c.field-meta.xml
Remote Changed Account.MVX_PreferredNumberOfProofsOfDelivery__c CustomField mediavelox\main\default\objects\Account\fields\MVX_PreferredNumberOfProofsOfDelivery__c.field-meta.xml
Remote Changed AdPosCatalog__c.AdPosition__c