You need to sign in to do that
Don't have an account?
Mike Lee PCL
Apex data processing help
Hello. I'm new to Apex and am looking for some advice regarding working with data and avoiding governor limits.
Here's what I'd like to accomplish:
1. Perform a SOQL query and grab some data from Contacts (roughly 500 records in total). The 500 records will be owned by 10 people.
2. With that data in hand further divide that data into groups sorted by ownerid. For example if 50 records are owned by ownerid = 'abc' I want to somehow be able to process those 50 records
3. In this scenario processing consists of emailing out a message to the email address associated with the ownerid
3. Once the email is sent move on to the next set of records owned by the next ownerid
I'd like to schedule this to run once a day.
I was thinking I could use a map with the ownerid as the key and a Contact sObject List as the values.
However not sure if this is something that can be scheduled???
Any help would be greatly appreciated!
Thanks,
Mike
Here's what I'd like to accomplish:
1. Perform a SOQL query and grab some data from Contacts (roughly 500 records in total). The 500 records will be owned by 10 people.
2. With that data in hand further divide that data into groups sorted by ownerid. For example if 50 records are owned by ownerid = 'abc' I want to somehow be able to process those 50 records
3. In this scenario processing consists of emailing out a message to the email address associated with the ownerid
3. Once the email is sent move on to the next set of records owned by the next ownerid
I'd like to schedule this to run once a day.
I was thinking I could use a map with the ownerid as the key and a Contact sObject List as the values.
However not sure if this is something that can be scheduled???
Any help would be greatly appreciated!
Thanks,
Mike
If you get your contacts in a construct like this - map<OwnerID,list<Contact>> (defined like map<id,list<Contact>> mOwnerIdContacts = new map<id,list<Contact>>();
Then you could process that map and do stuff with it.
Here is the code to load the map...
All Answers
If you get your contacts in a construct like this - map<OwnerID,list<Contact>> (defined like map<id,list<Contact>> mOwnerIdContacts = new map<id,list<Contact>>();
Then you could process that map and do stuff with it.
Here is the code to load the map...
Mike