Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
grunt.registerTask('runApex', 'Run Anonymous Apex specified by option -apex', function() {
var self = this;
var done = this.async();
var properties = grunt.config.get('properties');
var vlocity = new node_vlocity({
username: properties['sf.username'],
password: properties['sf.password'],
vlocityNamespace: properties['vlocity.namespace'],
verbose: grunt.option('verbose'),
loginUrl: properties['sf.loginUrl']
});
vlocity.checkLogin(function(res) {
vlocity.jsForceConnection.tooling.sobject('DebugLevel').find({ DeveloperName: "SFDC_DevConsole" }).execute(function(err, debugLevel) {
var thirtyMinutesLater = new Date();
thirtyMinutesLater.setMinutes(thirtyMinutesLater.getMinutes() + 30);
var thirtyMinutesLaterString = thirtyMinutesLater.toISOString();
vlocity.jsForceConnection.tooling.sobject('TraceFlag').create({
TracedEntityId: vlocity.jsForceConnection.userInfo.id,
DebugLevelId: debugLevel[0].Id,
ExpirationDate: thirtyMinutesLaterString,
LogType: 'DEVELOPER_LOG'