You need to sign in to do that
Don't have an account?
swapna muthiyalu
validate contact and account id
set<string>mEmpId = new set<string>();
set<string>hEmpId = new set<string>();
if (mEmpId .size() == 0 && hEmpId.size() > 0){
list<Contact> mgrHrRecs = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : hEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];
} else if(hEmpId.size() == 0 && mEmpId.size() > 0){
list<Contact> mgrHrRecs = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : mEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];
}else if (mEmpId.size() > 0 && hEmpId.size() > 0)
{list<contact>listcon = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : mEmpId and AccountId IN :accountids and indexm__c = ‘yes’) or (empid__c IN : hEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];} ;
The requirement is i have account say Burlington textiles, i have many contacts and they have empid__c. similar way there are many accounts and related contacts with empid__c. but the empid__c may be same for many contacts. now i want to validate that the reportsto field in contact has the same contact which belongs to the same account,which is not validated in the above code. for example i have jack as contact who belongs to the account burligton, has Peter in the report to field, now i have to validate that peter also belongs to the burlington account.
set<string>hEmpId = new set<string>();
if (mEmpId .size() == 0 && hEmpId.size() > 0){
list<Contact> mgrHrRecs = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : hEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];
} else if(hEmpId.size() == 0 && mEmpId.size() > 0){
list<Contact> mgrHrRecs = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : mEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];
}else if (mEmpId.size() > 0 && hEmpId.size() > 0)
{list<contact>listcon = [select id, empid__c,AccountId, Type__c from contact where (empid__c IN : mEmpId and AccountId IN :accountids and indexm__c = ‘yes’) or (empid__c IN : hEmpId and AccountId IN :accountids and indexh__c = ‘yes’) ];} ;
The requirement is i have account say Burlington textiles, i have many contacts and they have empid__c. similar way there are many accounts and related contacts with empid__c. but the empid__c may be same for many contacts. now i want to validate that the reportsto field in contact has the same contact which belongs to the same account,which is not validated in the above code. for example i have jack as contact who belongs to the account burligton, has Peter in the report to field, now i have to validate that peter also belongs to the burlington account.
How to do this by using map of map like account and contact ?