Simon Fell > Its just code > January 2007

Wednesday, January 31, 2007

Whoa, that's what I call a spike!, looks like they've got a big success on their hands, I'm itching to see how well SF3 plays together with SpanningSync.

Sunday, January 28, 2007

I've been trying to setup an Aperture vault on a network server, and failing miserably, hopefully this article will get me going. It seems like the Apple folks really prefer local firewire drives over networked drives, I get the impression that time machine won't support samba drives either for its backup storage.

Saturday, January 27, 2007

The release train rolls on, I just posted an updated version of PocketHTTP to address a couple of issues, (i) you could still get bogus gzip errors because under certain conditions it would apply the crc calc out of order and (ii) there was an issue with how the connection pool managed proxied SSL connections, that would result in it giving you the wrong connection if you trying to do proxied ssl to multiple different target hosts.

Saturday, January 27, 2007

I got tired of juggling a pile of different Salesforce logins (production, test instance, developer editions), and so I put together Trapdoor, an(other) OSX application, it securely stores all your login's on the keychain, and can quickly login for any of them. All of the your relevant credentials are listed in both the applications 'Login' menu and, and on the Dock icon's context menu, so you can quickly access it. Simply select one of the items from the menu for it to automatically log you in and leave you on the home page.

Friday, January 26, 2007

I posted an updated version of zkSforce, my objective-c library for accessing the API, I updated it to the 8.0 API, added support for SOQL-R queries, search, describe caching and a few other bits'n'peices. If you try it out, let me know how you get on.

Friday, January 26, 2007

I have a long list of things I want to build, recently most of them have a Mac focus, I just wish I had more time to work on them. I doubt i'll get to this one anytime soon, but i think it'll be really cool, take MacFUSE, the Objective-C wrapper for it and zkSforce, and expose the Salesforce document store as a filesystem (which would get indexed by spotlight etc). Seems like it might be a really nice way to integrate the document storage onto the desktop. (then rinse & repeat for Amazon's S3).

Monday, January 22, 2007

There's a new build of SoqlX, this has a reworked details window (the drawer has gone), that includes all the new 8.0 properties in the describe, along with a new schema report, and a few other tweaks. There's still some work to be done on the syntax colorer, but its a good step forward from 0.71, so i decided to release it. If you have a previous version, it should auto update for you.

Sunday, January 21, 2007

It appears that a common misconception is that when you're navigating FK relationships, you use the target object name, this might be because of a lot of samples use account / contact, which happen to have relationships named account & contacts. But this is not the case, this won't work when there are multiple relationships to the same target object (createdBy, lastModifiedBy, anyone?). Its always the name of the relationship, here's a few more examples to demonstrate.

select name, createdBy.alias, lastModifiedBy.alias from Account

select name, from contact

select name, from Account

select id, role,, from accountPartner

One more thing you'll probably run into soon, is how polymorphic foreign key's are handled, in this case, the SOQL relationship actually points to a special SObject called Name, and you query fields on the Name object. Name contains a common subset of fields, if you need to access type specific fields, then you can use the Id and Type fields on Name to drive a retrieve call to fetch the type specific fields. You can tell if a relationship is one of these special relationships by looking at the namePointing flag on the field in the DescribeSObjectResult, or by looking at the type of the field in the enterprise WSDL. here's a Name example.

select id, subject,,, what.type, owner.alias from Task

Finally, Name (and couple of its friends) are only usable as the target of a relationship in SOQL-R, they are not directly queryable, e.g. select firstName, lastName, id from Name will return an error, this is what the queryable fiag in the describe results means.

Friday, January 19, 2007

Expanding on my collection of OSX and Salesforce related tools, I just released v1.0 of Maildrop, which provides the ability to take emails and create Case or Activity in Salesforce (ala Outlook edition). It works with both Apple's Mail and Microsoft's Entourage.

Thursday, January 18, 2007

API 8.0 (aka the Winter '07 release) is live everywhere, which means everyone can now benefit from probably the biggest single API release out of, there's a ton of new features and functionality in there, where to start? well, probably the most popular new feature will be SOQL-R (aka SOQL Relationships aka SOQL Joins), this allows you to navigate your data model and query other objects related to the primary one, here's a simple example, that I actually used in the latest build of SF3

Select id, firstname, lastname, from contact

So, in addition to querying the id, firstname and lastname values from the contact, it'll also follow the account relationship and fetch the account's name field. You can also go the other way and use the reverse relationship, e.g.

select id, name, (select firstname, lastname from contacts) from account

This time, we query id and name from account, and for each account we query the firstname and lastname associated with the account. Unlike a SQL join, where this data would be flatted into a single table, this actually returns a real hierarchical structure. You can also filter inside those aggregate queries, e.g.

select id, name, (select firstname, lastname from contacts where lastname like 'a%') from account

You can now also order and/or limit the size of the results, e.g.

select id, name, (select firstname, lastname from contacts) from account order by name
select id, name, (select firstname, lastname from contacts) from account order by name limit 5
select id, name, (select firstname, lastname from contacts order by lastname desc) from account order by name limit 50

I've barely scratch the surface, go check out the docs for info on all the extra features for SOQL, next up I'll talk about some new tricks for the upsert call.

Thursday, January 18, 2007

I was at Apex day in San Francisco yesterday, there was an impressive turn-out, I saw lots of new faces, along with a few familiar faces from Dreamforce. Developer's at the event were lucky enough to be able to signup for the developer prerelease of Apex Code. In addition to the support for triggers that Apex Code brings, Apex Code also supports exposing your code as a fully fledged web service, complete with WSDL, and powered by the same high performance, highly interoperable web services implementation that drives the primary API. In Apex code the private/public specifier has an additional option, its actually private/public/webService. Simply create your code in a package, and mark the method as webService, e.g.

package wsDemo {
    webService String sayHello(String name) {
        return 'Hello ' + name;
and you'll have a complete WSDL for calling this code. Of course, no one needs a web service to do string concatenation, where this really comes into its own is build your own transactional units for doing integrations. Anyone who's built a complex data integration with salesforce (or any other distributed system) knows the pain of trying to manage transactional units that are different at the both ends, and having to build compensating transactions etc. Simple examples like creating an opportunity and all its line items in a single transactional unit could of been achieved by evolving the existing API, however more complex uses cases, where the developer needs to update 5 objects, delete 3 and create 1 new object all in a single transaction, just can't be handled by evolving the existing API. But, now you can build your own API's that have exactly the transactional boundaries you want. In Apex Code, you the developer control the transactions, so you can write a method that receives all the data needed as inputs, it can do a number of data operations, including create, update, delete, using data from both the request, and existing data in the system, then at the end only commit if everything went ok. Using Apex Code with its Web Services support I think will be a really powerful and easy way to do complex data integrations. Here's an Opportunity / LineItem sample, as the calls to insert will throw an exception if there's an error, and if the exception leaves your code, your transaction is rolled back, the entire call will either fully succeed or fail.
webService ID createOrder(Opportunity o, OpportunityLineItem [] items) {
   for (OpportunityLineItem i : items) {
      i.opportunityId = o.Id;
   return o.Id;

Wednesday, January 17, 2007

I just posted an updated version of SF3, it has a number of bug fixes in both the address book and iCal sync, along with a move to API 8.0, and using SOQL-R to query contacts + account info in a single query, so sync'ing a large number of contacts should be faster. If you have an earlier version of SF3 installed, next time you start it, it'll offer to update itself for you.

Thursday, January 11, 2007

Tonight's CocoaHeads meeting is going to be at the Apple store in San Francisco, see you there.

Tuesday, January 9, 2007


Congrats to the ADN team on their new site, looks awesome, and the Wiki in addition to the forums is going to make it a great resource for anyone doing development on the Apex platform. Also Apex Day is next week, I should be at the San Francisco event, see you there!.

Saturday, January 6, 2007

I burnt way too many hours tracking this one down, so hopefully this'll help someone else. Like a lot of Mac apps, Entourage has a scripts menu, drop a compile applescript file (.scpt) file into the Documents/Microsoft User Data/Entourage Script Menu Items and they'll magically appear in the scripts menu. However because the current Entourage version is from 10.2.8 days, it requires the script files to have a resource fork, that's not a problem if you're writing them directly with script editor, but if you're trying to use the XCode compile apple script build phase, or even just having the .scpt files copied into your built resources directory, then by default XCode will strip out the resource forks, making them useless to Entourage. It took me a way too much time to work that out, once i did, then I quickly found the preserve HFS data option in the xcode project to have xcode copy the scpt's into the resources folder preserving the resource fork. Now back to doing some actually useful work.