function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sean_kSean_k 

Id feild in custom objet

Hi,
I created a custom object called myAccount on sforce,and programatically inserted some data.when i tried to display the data i got A Nullpointer exception at
qr.getRecords(i).getId().getValue();

I did not create any feild with name Id,but my understanding is id is a implicite feild.

I created the Record Name:Account_key with data type Auto Number and display type {0}
is it causing any problem?

Thanks
Sean
SuperfellSuperfell
does your query include the Id field in the select list ?
Sean_kSean_k
Wow that was a quick reply..thanks a lot.
yes Id was not there in the select query,i thought as getId() is part of API it will implicitely set that.

If id is treated as a normal feild,why it is not displying when i use the following code.(It displays the other names and values though...)

for (int i=0;i MessageElement[] records = qr.getRecords(i).get_any();
HashMap fields = new HashMap();

// if (qr.getRecords(i).getId() != null) fields.put("id", "'"+qr.getRecords(i).getId().getValue()+"'");
for (int j=0;j MessageElement record = records[j];
if (!fields.containsKey(record.getName().toLowerCase())){
String recname = record.getName().toLowerCase();
String value = record.getValue();
System.out.print("Record name = "+recname);
System.out.println(" Value = "+value);
fields.put(record.getName().toLowerCase(),"'"+record.getValue()+"'");
}
}
SuperfellSuperfell
Its a bug in Axis, the actual soap response includes both the Id element for the base sObject and then a second instance of the id element for the any collection. However Axis doesn't correctly deserialize this, and it writes both the id elements to the base id property.
kamalkumarkamalkumar
Sean,
 
I am new to Java and Salesforce . I am looking forward to use the custom objects from a JSP page and not able to do that.
 
if possible do provide the working code using the custom objects.
 
Thanks in advance
SuperfellSuperfell
I suggest you go work through the quick start, it covers all that.