You need to sign in to do that
Don't have an account?
RajanJasuja
SOQL not returning result
Hi,
I am inserting an account and then selecting the same account using SOQL. Here is the code.
Thanks,
Rajan
I am inserting an account and then selecting the same account using SOQL. Here is the code.
Database.saveResult[] insertedCompanies = Database.insert(companyList,true); Set<Id> successIds = new Set<Id>(); for(Database.saveResult aRes : insertedCompanies){ successIds.add(aRes.getId()); } System.debug(successIds); List<Account> getAccounts = new List<Account>([SELECT Id, Name, Duns_Site_ID__c FROM Account WHERE ((Duns_Site_ID__c IN : dunsIdSet) OR (Id IN : successIds))]); System.debug(getAccounts'+getAccounts);When I run this code as a system admin System.debug(successIds); shows me an account ID in set and then query return the same record in getAccounts. But when I run the same code from a custom profile System.debug(successIds); shows me an account ID in set. But SOQL is not returning any result. My custom profile user can see the account which comes in successIds. Which means he do have access of account. Any suggestion what could be the issue?
Thanks,
Rajan
Setup => Security Controls => Sharing Settings
If it's Private, this likely be the cause you don't see results in the SOQL as the owner of the Acccount is not shared.