Wednesday, November 10, 2010

NO-SOFTWARE Tutorial for Salesforce Web Services

First... the gripes against Salesforce. Please feel free to open the actual tutorial if you're not interested in reading about how a billion-dollar company published an API with a lack of documentation that would induce balding in even a teenage developer.

16 man-hours of angst and frustration with Salesforce finally yielded a fruit that I can eat and then sleep on. Who would've thought that Salesforce, in its infinite wisdom, with its "NO SOFTWARE" slogan, would overlook the need for a tutorial that shows how to use the Salesforce WSDL in conjunction with the Web Services API. I certainly didn't expect this lack of documentation and support (which is Premier Support in my case).

As a newbie who has never touched a web service before with an immediate and urgent need to call one from my Salesforce org, I had no idea where to begin. Furthermore, my hopes were dashed when I discovered that the Quick Start chapter in the Web Services API Developer's Guide used Apache Axis or Microsoft Visual Studio as an integral part of the tutorial. What happened to "NO SOFTWARE"? Doesn't the Salesforce platform support both inbound messages and outbound messages for web services?

My chagrin was further exacerbated when I discovered to my extreme disappointment that neither the Salesforce-generated Enterprise WSDL nor the Partner WSDL could be directly imported back into Salesforce using the Generate from WSDL feature for Apex classes. Now, where have I encountered a very similar irony... Oh, yeah! I wrote about it in a previous post, "Salesforce CSV Format for Report Exports Is Not IETF RFC 4180-compliant".

Needless to say, when I thought that my first foray into web services would be made less painful by using Salesforce as the learning platform, I thought very, very wrongly. Well, I shouldn't say that, since the experience could've been worse if I had to write two web services from scratch in Java or something.

Anyway, thanks to an abundance of hope and the following inspirations found on the Internet, I believe I now have a workable tutorial that newbies like myself can use to familiarize themselves with using web services in Salesforce.
JavaRanch

Force.com Discussion Boards
If this tutorial helps even one person, I will consider the 16 hours well spent.

Thursday, October 21, 2010

Default Status for Emails Synced through Salesforce for Outlook

The default Status value that is assigned to emails synced via Salesforce for Outlook is not the oldest Status value, but rather the first Status value on the list that marks an Activity as Completed.

For example, the Status picklist had the following options:
  1. Not Started
  2. In Progress
  3. Completed
Then, I inserted a new option before "Completed":
  1. Not Started
  2. In Progress
  3. Completed through another activity
  4. Completed
When I sync an email with Salesforce for Outlook, the email is not recorded with Status set to "Completed". Instead, the email is now logged with Status set to "Completed through another activity".

To fix this problem, all I have to do is reorder the picklist so that "Completed" comes before "Completed through another activity". There is no need to delete any picklist options and then recreate them.

Wednesday, October 20, 2010

IETF RFC 4180-compliant CSV Reader for Salesforce

After several failed attempts at creating an IETF RFC 4180-compliant CSV reader for Salesforce, I finally have a candidate of an Apex Class that may be able to fit the bill for reading a compliant CSV file and returning a nested List where the outer List contains row records, and the inner List contains the sequential values in that row.

Edit

Posting the code within a PRE tag did not work. Let's try this download link instead.

Tuesday, August 24, 2010

Passing Data between Visualforce Pages with Controllers and Extensions

I spent a fair amount of time yesterday trying to figure out how to pass information back and forth between Visualforce pages, despite finding a pretty good article in the Force.com IDE Library.

"Creating a Wizard with Visualforce Pages"
http://www.salesforce.com/us/developer/docs/cookbook/Content/vf_wizard.htm

The article got me started, but then when I moved to the actual implementation in which I wanted to use controller extensions, I would be able to pass data between pages until I started including the extensions. I was left scratching away at my head for a while.

Finally, after many trials and errors, I came to the following conclusion: In order for data to be maintained from page to page, both the controller and the extension(s) referenced must be the same across all pages in the group.

For example, assume that the following Apex classes exist:
  • MyController
  • MyPage1Ext
  • MyPage2Ext

Also assume that I am trying to pass data between the following two pages, each of which uses the functionality included in the corresponding extension:
  • MyPage1
  • MyPage2

If I specify different attributes extensions="MyPage1Ext" and extensions="MyPage2Ext" for the two pages, then I am unable to pass data back and forth even if I specify the same controller. The trick is to use the same controller and the same extensions on both pages via the attribute extensions="MyPage1Ext,MyPage2Ext".

This is a bit depressing to know, but at least now I have a framework within I can build my actual application.

Wednesday, August 18, 2010

How to Fix Backspace in SSH Session to Unix ksh Terminal

I've been annoyed for a while now by the fact that when I start an SSH session to a AIX server that uses KornShell (ksh), my backspace key no longer deletes the character immediately preceding the cursor.

Luckily, I came across a forum thread that gave a solution for this annoyance.

"KSH Terminal Settings"
http://www.unix.com/unix-dummies-questions-answers/25310-ksh-terminal-settings.html

What I found out was that I could start the SSH session and then type the command stty erase ^H, which would enable me to delete correctly both within the SSH session and in my native Mac OS X Terminal after I ended the session.

The only (possible) problem is: Now that I've changed the erase character on the server, it appears to have "stuck". So, I hope other people who are accessing the server don't suddenly find that their backspace keys have now stopped working...

Monday, August 9, 2010

Salesforce CSV Format for Report Exports Is Not IETF RFC 4180-compliant

At the time of writing this post, I believe the published standard for CSV file formatting is the IETF RFC 4180.

Also at the time of writing this post, I believe that the Summer 2010 version Salesforce does not produce IETF RFC 4180-compliant CSV files for exported reports.

Here are a few differences in the Salesforce CSV file:
  • Salesforce uses a single LF ('\n') to start a new row of data instead of a CRLF ('\r\n').

  • Salesforce exports line breaks in street addresses with just a LF instead of the CRLF specified by the RFC.


A few more noteworthy considerations for the Salesforce report CSV files:
  • All values are delimited with double-quotes.

  • Salesforce does double double-quotes for values that contain the double-quotes character, as stipulated in the RFC.

  • For Text Area fields, Salesforce does convert line breaks in the field value to CRLF sequences, with the exception of native Street fields.

  • There is a footer in the CSV file that does not contain any data at all, which may complicate straight data imports into other systems or programs like Microsoft Access.

Wednesday, August 4, 2010

Putting a Name with a User ID in DegreeWorks

I came across a question once about what users all exist in DegreeWorks. I couldn't figure out the issue at first, so I created an SR with the AL and got some pointers that ultimately led me to the following query:

select shp_access_id, rad_name
from shp_user_mst, rad_primary_mst
where shp_access_id=rad_id
order by shp_access_id;


This query showed me the names associated with each of the logins to DegreeWorks.

On a side note: The DegreeWorks schema is not documented in any of the PDF publications. Instead, the schema is explained in files that are created during the server installation inside the .../app/schema/ directory:
  • dapdb
  • raddb
  • shpdb