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
fedevelapsfedevelaps 

User object does not have permissions to a Contact object

hello,

i have an application through the SOAP API using axis 1.4

Some users are getting an error:

javax.servlet.ServletException: javax.servlet.ServletException: #{loginBean.login}: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
because the following query returns zero objects and it should not:

"Select AccountId, Id, email from Contact where email='"+userInfo.getUserName()+"'"

I have verified that there is a Contact and a User with matching email and username fields.

I think it is a permissions problem since when i log into salesforce if i try to access the contact object by its id, i get a insufficient priviledges error.

What determines which contact objects users can see?

I would greately appreciate any help.

Thank you in advance.

Federico

Execute EZSAASExecute EZSAAS
Edit this user's profile (from Setup) and enable atleast "Read" permissions on Contact object under "Standard Object Permissions".
It is always a good practice when dealing with arrays to check if length of array is > 0 before accessing its elements.