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
Julio Cesar BollJulio Cesar Boll 

SOQL retrieve limited?

Guys, I'm doing an integration using Partner WSDL.

When I try to retrieve more than 15 Leads, it's return NullPointerException and I have 43 Leads.
When I try to retieve all my Contacts, it's just return 23 and I have 43 Contacts.

Important, Contacts doesn't do any error, but Leads do.
Someone can explain?
Best Answer chosen by Julio Cesar Boll
NagendraNagendra (Salesforce Developers) 
Hi Julio,

As this post is already answered in stack exchange community as below:
lead.setFirstName(sobj[j].getField("FirstName").toString());
The Lead FirstName field is not required. As such, it will return as null via the API if it is not defined.

You will need to check if it is null before attempting to convert it to a string.

It is likely that you are only getting a subset of records back for the SOQL query as the API user that the session belongs to doesn't have access to all the records in question.

Please mark this post as solved so that it gets removed from the unanswered queue and will be available as proper solution which results in helping others who are really in need of it.

Best Regards,
Nagendra.P

All Answers

NagendraNagendra (Salesforce Developers) 
Hi Julio,

As this post is already answered in stack exchange community as below:
lead.setFirstName(sobj[j].getField("FirstName").toString());
The Lead FirstName field is not required. As such, it will return as null via the API if it is not defined.

You will need to check if it is null before attempting to convert it to a string.

It is likely that you are only getting a subset of records back for the SOQL query as the API user that the session belongs to doesn't have access to all the records in question.

Please mark this post as solved so that it gets removed from the unanswered queue and will be available as proper solution which results in helping others who are really in need of it.

Best Regards,
Nagendra.P
This was selected as the best answer
Julio Cesar BollJulio Cesar Boll

Thanks Nagendra,

Yesterday I did'nt had time to close the question here.
My issue was really that, because when you do

toString()

It can be NULL, but String don't accept it, then I'll need to filter the toString() to set the correct value.

Regards,