• Darwin
  • NEWBIE
  • 0 Points
  • Member since 2006

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 6
    Replies
Hi there,
 
we have setup a new customer object class (let's call it NewCustomerObject__c) in our sandbox. After that we created a couple of instances of this object by using.
I wrote JAVA class that performs a simple query: (SELECT  Attribute__c from NewCustomerObject__c).
When iterating over the results
 

private void queryTest() {

String queryString = "SELECT id FROM NewCustomerObject__c";

List results = Functions.executeQuery(queryString);

Iterator it = results.iterator();

while (it.hasNext()) {

SObject newObject = (SObject) it.next();

System.out.println("Class : " + newObject.getClass());

}

}

The method getClass() returns com.sforce.soap.enterprise.sobject.SObject.

I can't cast newObject to no other class but SObject either.

NewCustomerObject newObject = (NewCustomerObject) it.next(); fails.

If I run the same method after replacing NewCustomerObject__c with a customer object that had been setup up earlier in the enterprise portal. => And had been copied into the sandbox, the getClass() method returns com.sforce.soap.enterprise.sobject.CustomerObject__c. In that case the class cast works, too.

What can I do to fix this?

 

  • October 30, 2007
  • Like
  • 0
Hi there,
 
I'm using Eclipse 3.3.1 with Apex Plugin. From what I understand, objects created in Eclipse (e.g. s-controls) are automatically created in Salesforce also. That part works fine.
But if I change the s-control and save it in Eclipse it will not be updated in Salesforce. Why is that?
 
Thanks
  • October 18, 2007
  • Like
  • 0
Hello,
 
handling the sforce - API is quiet new to me. I think it's the best way to describe what I've already done:
 
I've downloaded the Enterprise WSDL, and succeeded in generating customer object classes.
 
When I try to query any one of these customer object, I get the message above.
...
queryString = "select Plan_Summe__c from Projekt__c";
        try {
            qr = binding.query(queryString);
            boolean done = false;
            if (qr.getSize() > 0) {
                while (!done) {
                    for (int i = 0; i < qr.getRecords().length; i++) {
                        Projekt__c records = (Projekt__c) qr.getRecords(i);
                        System.out.println("Summe: " + i + " " + records.getPlan_Summe__c());
                    }
...
 
When I try to bypass the 'invalid field' problem by using an ID-field as it is used in alle SObject classes, I will encounter a ClassCastException. Querying a standard SObject (e.g. Contact) works fine. The debugger showed that the QueryResult contains an array of com.sforce.soap.enterprise.sobject.SObject when it should instanciate com.sforce.soap.enterprise.sobject.Projekt__c.
 
What could be the problem?
 
Thanks in advance.
Andy
 
 
  • March 13, 2006
  • Like
  • 0
Hi there,
 
we have setup a new customer object class (let's call it NewCustomerObject__c) in our sandbox. After that we created a couple of instances of this object by using.
I wrote JAVA class that performs a simple query: (SELECT  Attribute__c from NewCustomerObject__c).
When iterating over the results
 

private void queryTest() {

String queryString = "SELECT id FROM NewCustomerObject__c";

List results = Functions.executeQuery(queryString);

Iterator it = results.iterator();

while (it.hasNext()) {

SObject newObject = (SObject) it.next();

System.out.println("Class : " + newObject.getClass());

}

}

The method getClass() returns com.sforce.soap.enterprise.sobject.SObject.

I can't cast newObject to no other class but SObject either.

NewCustomerObject newObject = (NewCustomerObject) it.next(); fails.

If I run the same method after replacing NewCustomerObject__c with a customer object that had been setup up earlier in the enterprise portal. => And had been copied into the sandbox, the getClass() method returns com.sforce.soap.enterprise.sobject.CustomerObject__c. In that case the class cast works, too.

What can I do to fix this?

 

  • October 30, 2007
  • Like
  • 0
Hello,
 
handling the sforce - API is quiet new to me. I think it's the best way to describe what I've already done:
 
I've downloaded the Enterprise WSDL, and succeeded in generating customer object classes.
 
When I try to query any one of these customer object, I get the message above.
...
queryString = "select Plan_Summe__c from Projekt__c";
        try {
            qr = binding.query(queryString);
            boolean done = false;
            if (qr.getSize() > 0) {
                while (!done) {
                    for (int i = 0; i < qr.getRecords().length; i++) {
                        Projekt__c records = (Projekt__c) qr.getRecords(i);
                        System.out.println("Summe: " + i + " " + records.getPlan_Summe__c());
                    }
...
 
When I try to bypass the 'invalid field' problem by using an ID-field as it is used in alle SObject classes, I will encounter a ClassCastException. Querying a standard SObject (e.g. Contact) works fine. The debugger showed that the QueryResult contains an array of com.sforce.soap.enterprise.sobject.SObject when it should instanciate com.sforce.soap.enterprise.sobject.Projekt__c.
 
What could be the problem?
 
Thanks in advance.
Andy
 
 
  • March 13, 2006
  • Like
  • 0
I am running a query with enterprise api as follows:
qr = binding.query("select id from "+objName+ " where Name = '"+objInstanceNameValue+"'");
objName=Account and objInstanceNameValue has an account value.

I am getting the error:

18312 [main] ERROR org.apache.axis.client.Call - Exception:
org.xml.sax.SAXException: Invalid element in com.sforce.soap.enterprise.sobject.SObject - type
at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:258)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)

What could be the problem?
  • July 06, 2005
  • Like
  • 0