Tag Archives: Salesforce.com

Salesforce Schedule APEX Batch Job

To test an APEX Batch job, open the Developer Console then the Anonymous Execute window. Here’s the code to run the job:

1
2
3
4
5
6
7
8
9
10
11
datetime thisTime = system.now().addMinutes(1);
integer second = thisTime.second();
integer minute = thisTime.minute();
integer hour = thisTime.hour();
integer day = thisTime.day();
integer month = thisTime.month();
integer year = thisTime.year();

String timeStamp = second + ' ' + minute + ' ' + hour + ' ' + day + ' ' + month + ' ? ' + year;

String jobId = System.schedule('Test Opportunity Contact Lookup', timeStamp, new ZD_UpdateContactOpportunityBatch());

Salesforce Add Action To apex:enhancedList

There’s no quick way to add actions to the action column of an apex:enhancedList. Here’s the workaround.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<apex:page >
    <style>
    .x-grid3-dirty-cell {
        background-image: none;
    }
    </style>
    <script type="text/javascript">    
    function endsWith(str, suffix) {
        return str.indexOf(suffix, str.length - suffix.length) !== -1;
    }
    function setActions() {        
        Ext.ComponentMgr.all.each( function(item, index, length) {
            if(endsWith(item.id, "grid")) {                
                var action = '<a href="/apex/My_VisualForce_Page?id=%s"><span>My Action</span></a>';
                item.store.each( function(record) {
                    var id = record.id;
                    var temp = action;
                    temp = temp.replace("%s", id);
                    record.set("ACTION_COLUMN", [temp]);
                });
                item.store.on("load", function() {
                    item.store.each( function(record) {
                        var id = record.id;
                        var temp = action;
                        temp = temp.replace("%s", id);
                        record.set("ACTION_COLUMN", [temp]);
                    });
                });
            }
        });
    }
    </script>
    <apex:enhancedList type="Systems__c" height="300" oncomplete="setActions();" />
</apex:page>

Salesforce uses the Extjs framework (Sencha.com) to implement list views. All user interface components on an Extjs page are registered with a component manager. The code accesses the component manager, looks for a component whose id corresponds to a grid (our enhancedList), and then changes the action items in the store associated with the grid.

Network Security is Relative

That is why security experts aren’t surprised by the Sony story. We know people who do penetration testing for a living — real, no-holds-barred attacks that mimic a full-on assault by a dogged, expert attacker — and we know that the expert always gets in. Against a sufficiently skilled, funded and motivated attacker, all networks are vulnerable.

A quote from Bruce Schneier, probably the leading cryptologist on the planet, and whose blog I regularly read.

I’ve blogged before about computer security, and the ramifications of the NASA, Google, Sony, Target, Home Depot, JP Morgan, etc. attacks are apparent. The bad guys are winning. The market is ripe for a secure computing platform.

Salesforce Custom Hours Billed Quote with Conga Composer

For a recent client project working with the Salesforce.com platform I used Conga Composer to create custom quotes. The client is an engineering firm and one of the quotes listed employee hours billed under dynamic categories. Here’s how to create the quote.

Continue reading

Nullsoft Installer for Salesforce Java Swing & RSSBus Application

In a prior post I explained how to create a simple Java application that downloads Salesforce data via the RSSBus JDBC Salesforce driver. Here’s the script to create a Windows Installer that will install the Java application onto a Windows machine.

Continue reading

Salesforce.com Data Download via Java Swing, RSSBus JDBC Driver, and Apache Commons Daemon

I recently developed an application that synchronizes Salesforce.com data to a local PC. The application is developed in Java using the Swing graphical framework and uses a Salesforce.com JDBC driver provided by RSSBus. The application stores Salesforce.com credentials and synchronization interval timing data in a Java properties file. The application allows non-graphical execution via the “nogui” command argument. I also include an Apache Commons Daemon class and script that allows running the application as a service. The follow code is licensed under the GPLv3.

Continue reading

Salesforce Trigger To Add Contacts From Account Linked to Opportunity

I couldn’t find any example code on the Net to accomplish a task that is probably common amongst many Salesforce implementations. I have a requirement to link a second account to an opportunity in Salesforce. In my use case, the primary opportunity account represents a construction project general contractor, and the second linked account represents the building owner. I need to automatically pull the building owner account contacts into the opportunity contact roles list. Here’s the Salesforce Trigger to do just that:

Continue reading

PHP deficiencies

I’ve recently had the task of uploading a large dataset via a PHP script. My application is designed under a MVC paradigm, and the uploaded data was transferred via an array declared in the controller to the view from the model. After processing around 5,000 records my script died with an out of memory error – the 128 megabyte limit was reached. Wow, I wondered why my script was consuming so much memory?

Continue reading

Computer Security

Yesterday I read an article on a NASA security breach. Apparently, Chinese hackers hacked into the NASA Jet Propulsion laboratory and gained full network access. Incredibly NASA’s networks are insecure despite hackers gaining access to satellites a few years back. Its obvious current network intrusion prevention and detection methods are inadequate.

Corporations and government agencies across the board are failing to prevent security breaches.  Perhaps the same methods used by NASA for developing interstellar hardware should be used in the IT realm. If 8080 microprocessors are still used in hardware designs due to their known reliability, perhaps IT software systems should be judged for their reliability not their features.

I currently run Ubuntu Linux on my laptop and I’m fairly comfortable with OS security. I feel it’s impossible to be completely secure. If the right people intend to hack your system there are a million vulnerabilities on the net, and another million yet to be discovered or revealed. The National Security Agency supports a secure Linux kernel; however, mainstream Linux support for the secure kernel is limited.