You need to sign in to do that
Don't have an account?
Lukas van Rooyen
How to compare a result gotten from one query to the ID of another in where clause
I need to use Contact__c that I got in pol info query to compare it to the id of the cnt info query to get that info but what I have is obviously incorrect. Anybody have idea to fix that? Thank you.
InputId = ApexPages.currentPage().getParameters().get('InputId');
PolInfo=[Select Id,Name,Policy_Number__c, Contact__c From PolContract__c where Id=:InputId];
CntInfo=[Select Id,Name, MailingAddress from Contact where Id=:PolInfo.Contact__c];
InputId = ApexPages.currentPage().getParameters().get('InputId');
PolInfo=[Select Id,Name,Policy_Number__c, Contact__c From PolContract__c where Id=:InputId];
CntInfo=[Select Id,Name, MailingAddress from Contact where Id=:PolInfo.Contact__c];
https://blog.jeffdouglas.com/2010/02/22/soql-how-i-query-with-thee-let-me-count-the-ways/
Try below query: