1 Reply Latest reply on Apr 18, 2008 9:11 AM by ldtech

    Converting a SObject into other objects

      I'm doing my first SalesForce connection web site and have a question on how to retrieve and possibly cast some objects from my query. The basic code (after login which works fine) is to query the Contact table. After that, I want to grab some simple data back from it like "firstname" and such but I run into errors that "firstname" doesn't exist. I was told a possible solution to this might be to cast the return results into "Contact" objects. I'm not really sure how to do that since I don't have a java class attached that has any salesforce code in it, I'm simply trying to work through their webservice layer and retrieve this data to output on our website (ok, and eventually to update some of it).

      Is there a way to do this without integrating any java modules? All the information I've found so far is from 2004 (4 years old!) so I hope someone is still knowledgeable about this :) I posted some of the code below that works as well (left out a lot of the login code that already works).
        • 1. Re: Converting a SObject into other objects
          ldtech Level 1
          I should add that for those who don't know, the sfObject is the base object which the other objects extend. So a Contact is an extension of an sfObject. I figured the query would return the correct object type but it does not, a dump reveals it's being returned as the base sfObject. So I guess at the very least I need to know if you can convert a complex object to another complex object that extends it in CF. I found one or two other people saying they somehow completed their projects in CF (not that many) but I'm thinking more and more they did it through some extension of java and not much CF at all.