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
import { ensure } from '@salesforce/ts-types'; | |
import { NamedPackageDir, SfdxError, SfdxProject } from '@salesforce/core'; | |
const project = SfdxProject.getInstance(); | |
const pkgDirs = project.getUniquePackageDirectories(); | |
const pkgAliases = Object.keys(project.getSfdxProjectJson().getContents().packageAliases || {}); | |
class PkgDirNode { | |
public pkgDir: NamedPackageDir; |
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
const exec = require('child_process').execSync; | |
let lines = exec('sfdx force:org:list --all').toString().split(/\n/); | |
let index; | |
// Skip the non-scratch orgs | |
for (var i in lines) { | |
if (lines[i].toString().match(/.*SCRATCH ORG NAME.*/)) { | |
index = i; | |
break; |
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 bash | |
## | |
# Utility for converting json files to heads down camel case | |
## | |
if [[ $1 == "help" || $1 == "--help" ]] | |
then | |
echo "Usage: case-convert [help] path |
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
### Setup Import File and Permission Set | |
# Step 1. Export the RecordTypes | |
-> sfdx force:data:tree:export -q "SELECT ID, Name, DeveloperName, SobjectType FROM RecordType" -o data | |
Wrote 1 records to data/RecordType.json | |
# Here is what the export might look like | |
-> more data/RecordType.json | |
{ |
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
javascript: | |
console.log('Disabling auto close tags on all existing vf editors'); | |
Ext.getCmp('editors').items.each(function(editor) { | |
if (editor instanceof apex.editor.VisualforceEditor && editor.cmEditor) { | |
editor.cmEditor.codeEditor.setOption('autoCloseTags', false); | |
console.log('Removed autoclose on editor ' + editor.id); | |
} | |
}); |
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
SfdcDevConsole.ToolingAPI.query('SELECT Id, LogUserId, LogUser.Name FROM ApexLog', { | |
continuation : function(response) { | |
var records = response.records; | |
console.log('Found ' + records.length + ' log(s)'); | |
var idsToDelete = []; | |
for (var i = 0; i < records.length; i++) { | |
var rec = records[i]; | |
console.log('\t' + rec.Id + ' ' + rec.LogUserId); | |
if (!rec.LogUser || rec.LogUser === 'null') { | |
idsToDelete.push(rec.Id); |
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
//This example assumes you have a sendRequest method, that can send an AJAX call to Salesforce with Auth header all set up | |
function runNamespacedTest(namespace) { | |
function getTestIdsFromApexClasses(classes) { | |
var ids = []; | |
for (var i = 0; i < classes.length; i++) { | |
var rec = classes[i]; | |
var st = rec.SymbolTable; | |
var mods = st.tableDeclaration.modifiers; |
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
SoapConnection conn = // Get the tooling soap connection; | |
String namespace = ""; | |
QueryResult qr = conn.query("SELECT Id, SymbolTable FROM ApexClass WHERE NamespacePrefix = '"+namespace+"'"); | |
List<String> ids = new ArrayList<String>(); | |
SObject[] classes = qr.getRecords(); | |
for (int i = 0; i < classes.length; i++) { | |
ApexClass rec = (ApexClass)classes[i]; |
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
javascript:function runNamespacedTest(e){function r(e){if(console&&console.log)console.log(e)}function i(){Ext.Msg.alert("Running namespaced tests failed","Please look at the javascript console for more information.")}function s(e){if(e.length===0){Ext.Msg.alert("No tests enqueued",'No test found in namespace "'+n+'"');return}r("Enqueuing "+e.length+" tests");Ext.Msg.updateProgress(.6,"Enqueuing "+e.length+" tests");if(SfdcDevConsole.ToolingAPI.runTests){SfdcDevConsole.ToolingAPI.runTests({classids:e},{continuation:function(){Ext.Msg.close()},failure:i})}else{Ext.Ajax.request({url:"/_ui/common/apex/test/ApexTestQueueServlet",params:{action:"ENQUEUE",classid:e},success:function(){Ext.Msg.close()}})}}function o(e){var t=[];for(var n=0;n<e.length;n++){var i=e[n];var s=i.SymbolTable;var o=s.tableDeclaration.modifiers;var u=o.length;while(u--){if(o[u]==="TEST"){r("Found test: "+s.name);t.push(i.Id)}}}return t}function u(){SfdcDevConsole.ToolingAPI.query("SELECT Id, SymbolTable FROM ApexClass WHERE NamespacePrefix |
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
function runNamespacedTest(namespace) { | |
var thisOrgsNs = SfdcDevConsole.hasNamespace() ? SfdcDevConsole.namespace : ''; | |
var ns = namespace || thisOrgsNs; | |
function log(msg) { | |
if (console && console.log) console.log(msg); | |
} | |
function showErrorMessage() { | |
Ext.Msg.alert('Running namespaced tests failed', 'Please look at the javascript console for more information.'); |
NewerOlder