• imhere
  • NEWBIE
  • 5 Points
  • Member since 2005

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 4
    Replies
Hi
I am Querying CustomObject__c.
If i set Where clause on Name Field it workds fine ... But if i set Where Clause to myCustomField__c It executes the Query (query.isDone() is TRUE) . But throws NullPoiterException on queryResult.getRecords()

Name and myCustomField have the same values.

what is the best practice to Query a CustomObject__c ??

here is the TWo differnt Codes i am using ...

NO ERRORS Query:
query("select Area_ID__c, Service_ID__c from UserService__c where Name='"
+ name + "'");

NULLPOINTER QUERY:
query("select Area_ID__c, Service_ID__c from UserService__c where myCustomField ='"
+ name + "'");
  • January 03, 2006
  • Like
  • 0
i created a Custom Object : Area
using partner API .. create and describle call works fine.
But when i Query this object and cast it back in Area it gives Class Cast Exception

Folloing is the code:
queryResult = binding.query("select Name, City__c from Area__c");
while (queryResult.getRecords() != null)
{
for (int i = 0; i < queryResult.getRecords().length; i++)
{
LINE NO 425 Area con = (Area) queryResult.getRecords(i); // EXCEPTION ARISES HERE
String firstName = con.getName ();
String lastName = con.getCity__c();
System.out.println("Contact " + (i + 1) + ": " + firstName + " "
+ lastName);
}

queryResult = binding.queryMore(queryResult.getQueryLocator());
}

EXCEPTION IS :

java.lang.ClassCastException: com.sforce.soap.partner.sobject.SObject
at com.smartmicros.sforce.test.SamplesPartner.querySample(SamplesPartner.java:425)
at com.smartmicros.sforce.test.SamplesPartner.run(SamplesPartner.java:537)
at com.smartmicros.sforce.test.SamplesPartner.main(SamplesPartner.java:65)

I extended Area Object from SObject of parnters API.
wt i think is : SObject's instance is created and as the Instance is of base class it can not be Cast Down in Derived class's instance
would any one please guide me ?? The same Call for Account works fine using Enterprice API.
  • December 28, 2005
  • Like
  • 1
thx Ron
i have gone through that. i have about 30 objects in my app.
ONE
its a pains talking process of creating objects and their relationships

Is there any way that i can create Custom OBjects without going through this pain talking Process ? (create call only created an instance)


TWO
creating a Custom object creates Custom Tabs .. and now its length is increasing as a new object is created. it must start a new Tab linf after a specific no of tabs are added. so that user dont have to scroll each time.

If i dont create a Custom Tab i dont find any way to Edit the object or to create an instance of that. is there any suggestion ?

THREE
I could not find any way to Delete a Custom object. i can delete an instance but cant Object .. y is this so ?? is there any Solution

FOUR
wt does Standard Field means ? how is it different from other Custom Field.

Five
Ther is no way to create a relation of an Object to itself.

Six
Can i implement Composite Primery key ? How ?
  • December 20, 2005
  • Like
  • 0
hi,
i jsut started using sforce API.
initially it does not work. There was some Exception while i tried to use the sample Login Source Code.

i left that idea. and made my own soap request to connect and login to Scforce. taht worked fine.
now i want to create my OWN objects in sforce e.g. i want to create a JOB object that i can use later on.
how would it be done.
  • December 17, 2005
  • Like
  • 0
i created a Custom Object : Area
using partner API .. create and describle call works fine.
But when i Query this object and cast it back in Area it gives Class Cast Exception

Folloing is the code:
queryResult = binding.query("select Name, City__c from Area__c");
while (queryResult.getRecords() != null)
{
for (int i = 0; i < queryResult.getRecords().length; i++)
{
LINE NO 425 Area con = (Area) queryResult.getRecords(i); // EXCEPTION ARISES HERE
String firstName = con.getName ();
String lastName = con.getCity__c();
System.out.println("Contact " + (i + 1) + ": " + firstName + " "
+ lastName);
}

queryResult = binding.queryMore(queryResult.getQueryLocator());
}

EXCEPTION IS :

java.lang.ClassCastException: com.sforce.soap.partner.sobject.SObject
at com.smartmicros.sforce.test.SamplesPartner.querySample(SamplesPartner.java:425)
at com.smartmicros.sforce.test.SamplesPartner.run(SamplesPartner.java:537)
at com.smartmicros.sforce.test.SamplesPartner.main(SamplesPartner.java:65)

I extended Area Object from SObject of parnters API.
wt i think is : SObject's instance is created and as the Instance is of base class it can not be Cast Down in Derived class's instance
would any one please guide me ?? The same Call for Account works fine using Enterprice API.
  • December 28, 2005
  • Like
  • 1
Hi
I am Querying CustomObject__c.
If i set Where clause on Name Field it workds fine ... But if i set Where Clause to myCustomField__c It executes the Query (query.isDone() is TRUE) . But throws NullPoiterException on queryResult.getRecords()

Name and myCustomField have the same values.

what is the best practice to Query a CustomObject__c ??

here is the TWo differnt Codes i am using ...

NO ERRORS Query:
query("select Area_ID__c, Service_ID__c from UserService__c where Name='"
+ name + "'");

NULLPOINTER QUERY:
query("select Area_ID__c, Service_ID__c from UserService__c where myCustomField ='"
+ name + "'");
  • January 03, 2006
  • Like
  • 0
i created a Custom Object : Area
using partner API .. create and describle call works fine.
But when i Query this object and cast it back in Area it gives Class Cast Exception

Folloing is the code:
queryResult = binding.query("select Name, City__c from Area__c");
while (queryResult.getRecords() != null)
{
for (int i = 0; i < queryResult.getRecords().length; i++)
{
LINE NO 425 Area con = (Area) queryResult.getRecords(i); // EXCEPTION ARISES HERE
String firstName = con.getName ();
String lastName = con.getCity__c();
System.out.println("Contact " + (i + 1) + ": " + firstName + " "
+ lastName);
}

queryResult = binding.queryMore(queryResult.getQueryLocator());
}

EXCEPTION IS :

java.lang.ClassCastException: com.sforce.soap.partner.sobject.SObject
at com.smartmicros.sforce.test.SamplesPartner.querySample(SamplesPartner.java:425)
at com.smartmicros.sforce.test.SamplesPartner.run(SamplesPartner.java:537)
at com.smartmicros.sforce.test.SamplesPartner.main(SamplesPartner.java:65)

I extended Area Object from SObject of parnters API.
wt i think is : SObject's instance is created and as the Instance is of base class it can not be Cast Down in Derived class's instance
would any one please guide me ?? The same Call for Account works fine using Enterprice API.
  • December 28, 2005
  • Like
  • 1
hi,
i jsut started using sforce API.
initially it does not work. There was some Exception while i tried to use the sample Login Source Code.

i left that idea. and made my own soap request to connect and login to Scforce. taht worked fine.
now i want to create my OWN objects in sforce e.g. i want to create a JOB object that i can use later on.
how would it be done.
  • December 17, 2005
  • Like
  • 0