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

combine two different standard objects into single LIST
Hi all,
came up with a doubt,can i combine two different standard objects into single LIST
ie
List<contact> listname = List<contact>;
List<campaignmember> listname = List<campaignmember>;
i need to combine above two List into single one may be like (contact.campaignmember.date,contact.campaignmember.name)
i wrote a wrapper where i have access to those two list of data.now just need to combine and return them as list ,is that possible ??.
please post possible ideas to do that.
Thanks
D Naveen Rahul.
http://www.minddigital.com/what-is-wrapper-class-and-how-to-use-it-in-salesforce/
You cannot put to different objects into a list that is defined to have a specific type. You can put them together in an inner class and have it added to the list.
I am wondering if you are trying to pull the Campaign members who are also contacts, is that so?
You can get the list directly from the SOQL.
Here is a article that will help you understand it better.
http://www.cloudforce4u.com/2013/06/how-to-use-wrapper-class-in.html