I'm building a trigger that everytime a Campaign Member is added , Salesforce sends an email to the Owner of the Account where the Contact Lives that a Campaign Member is added.
Due to Salesforce governor limits I can query my way through the data, so I'm storing the data on Lists of Ids, Contacts, Accounts and Users.
I want now to create, based from that Data, a List that would look like a table with Rows and Columns. Something like these:
Info[0]='Contact Id', 'Account Id' ,'UserId','User Email'
Info[1]='Contact Id', 'Account Id' ,'UserId','User Email'
Info[2]='Contact Id', 'Account Id' ,'UserId','User Email'
Info[3]='Contact Id', 'Account Id' ,'UserId','User Email'
Right now I'm using this:
List<List<string>> lists = new List<List<string>>();
And thought(Incorrectly) that I could just add the info like this:
lists[0][0] = ContactId;
lists[0][1] = AccountId;
Using this method I'm getting the error: List index out of bounds: 0
Hope you can help me.