So i have list id and query soql until I get the result. It looks like that, i want to query that soql for each id until i get result. It doesn't work good, but no error. FieldId__c is id from another object.
List<String> ids = new List<String>(); //just for example, i am getting id with method.
for (String id : ids) {
Object__c objList = [SELECT Id FROM Object__c WHERE field__c = 'something' and FieldId__c = :id];
if (objList.id != null) break;
}
Best Answer
According to updated question with details, you can make one SOQL query with
IN
:You can also make a map that matches initial Id with retrieved Object__c, if you need it later: