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

putting values in one MAP
global class GSQM_ESH_MonthlyReportsEmailAlertSch implements Schedulable{
List<GSQM_ESH_Audiometry__c> personsResponsible = new List<GSQM_ESH_Audiometry__c>();
Set<String> personIDSet = new Set<String>();
Set<String> audiometryIDSet = new Set<String>();
Map<String, String> personIDAudioID = new Map<String, String>();
global void execute(SchedulableContext sc) {
personsResponsible = [SELECT Id, Person_Responsible_for_Assessment__c,reportDate__c FROM GSQM_ESH_Audiometry__c];
for(GSQM_ESH_Audiometry__c obj : [SELECT Id, Person_Responsible_for_Assessment__c FROM GSQM_ESH_Audiometry__c]){
personIDSet.add(obj.Person_Responsible_for_Assessment__c);
audiometryIDSet.add(obj.Id);
}
System.Debug(personIDSet);
list<String> email = new list<String>();
list<user> usersObj = [SELECT email from user where Id=:personIDSet];
for(user userObj: [SELECT email from user where Id=:personIDSet]){
email.add(userObj.email);
}
System.Debug(email);
list<String> employeeName = new List<String>();
for(GSQM_ESH_Employee_for_Audiometry_Test__c obj : [SELECT Employee_Name__c FROM
GSQM_ESH_Employee_for_Audiometry_Test__c
WHERE Audiometry__c=:audiometryIDSet]){
employeeName.add(obj.Employee_Name__c);
}
System.Debug(employeeName);
}
}
this is my code i am able to fetch the records but i want to relate all the records can anyone guide me how to relate it may be through a map .......so i can send complete information according to the same user? THanks i am new to Apex
I don't understand what you need.
You can do Maps like
Map<String, String> myMap = new Map<String, String>():
Or even
Map<Id, Account> myAccountMap = [Select Id, Name From Account Limit 100];
You might enjoy http://developer.force.com/cookbook/recipe/initialising-maps-from-queries