You need to sign in to do that
Don't have an account?

Retrieve value from SOQL results
This seems like a dumb question. So dumb, in fact that I'm having trouble finding the answer to it. To preface. I am not an Apex Developer(I'm a C# guy). I've just been helping out a friend get some stuff done. I've pretty much taken care of all the hardest parts of the code, but this last one is baffling me.
I need to update a field on the Lead record from the results of a SOQL query to a custom entity.
The problem is, I have no idea how to retrieve anything from the query. For most of my coding to now, I've used the List<> to get things to match up right for the rest of the code. But I can't seem to get that field value out of it. Here is the list. Any help... from anyone. (even if it is just to point me in the right direction) would be very helpful. Thanks.
(I need the value in the TFA_Salesforce_ID__c field on the Member_Verification__c Entity as a string value)
list<String> leadEmails= new list<String>();
for (Lead lead:Trigger.new) {
leadEmails.add(lead.Email);
}
list<Member_Verification__c> emails = [
Select id, Primary_Email__c,TFA_Salesforce_ID__c
from Member_Verification__c
where (Primary_Email__c != null and Primary_Email__c in :leadEmails)
];
Now you can assign that to a field you want. Hope this helps.
All Answers
Now you can assign that to a field you want. Hope this helps.