function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
withoutmewithoutme 

CampaignMemberRecordType

Hey
I have a custom VF button in my Campaign Detail page. This button queries the Campaign members and generates a pdf document (list of members and there submissions).

Depending on the campaign member record type selected, i want to generate a different list - Survey, Webcast etc etc.

How do I pass the CampaignMemberRecordTypeId from campaign detail page to the VF page?

Doing     Campaign cap = [select Id, CampaignMemberRecordTypeId from Campaign where id = :campid];

only gives an error saying "CampaignMemberRecordTypeID" - No such Column? 


 

Also, I need to be able to compare the above campaignmemberrecordtypeid with the specified record type ids for campaign member. So I did this
Schema.SObjectType.CampaignMember.getRecordTypeInfosByName().get('Survey').getRecordTypeId()

only to get null. What am I doing wrong?
-VJ

Message Edited by withoutme on 01-24-2010 11:07 PM
bob_buzzardbob_buzzard

The campaign members have references to the parent campaign rather than the other way around.

 

Thus if you want to get the record type (or types?) for the campaign, you'll need something like:

 

List<CampaignMember> cmList=[select id, RecordTypeId from CampaignMember where CampaignId=:campid];

jkucerajkucera

The field name on Campaign is:

 

CampaignMemberRecordType

 

Not 

 

CampaignMemberRecordTypeID

 

Not sure the problem on the getRecordTypeID() - perhaps case sensitive?