Tag Archives: VisualForce

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