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
DavidHabib.ax407DavidHabib.ax407 

API to Campaign object's CampaignMemberRecordType field

Campaign object's now have a CampaignMemberRecordType field which is the record type to create CampaignMember records with. 

 

Unfortunately, I can't set it in Apex code.  Eclipse complains with "Invalid field CampaignMemberRecordType for SObject Campaign".

 

I also tried using CampaignMemberType, but also got an Eclipse error.

 

What do I need to do to be able to set this programmatically?

 

Thanks,
Dave

Best Answer chosen by Admin (Salesforce Developers) 
jkucerajkucera

Ah - sorry for the "is your computer plugged in" response. 

 

You're using the wrong field name.  You need to use:

 

CampaignMemberRecordTypeId  

All Answers

jkucerajkucera

Hi David - the Campiagn Member Type field on the Campaign Page Layout is actually pointing to Campaign Member Object record types.

 

You can create Campaign Member record types using the API to populate this field.

 

The reason we implemented it this way is so that all members of a campaign will have the same type, so you only have to set the value once regardless of how many times you add people to a campaign.  It simplifies the clicks quite a bit and works for 95% of the use cases.

Message Edited by jkucera on 10-14-2009 02:40 PM
Message Edited by jkucera on 10-14-2009 02:40 PM
Message Edited by jkucera on 10-14-2009 02:41 PM
DavidHabib.ax407DavidHabib.ax407

I understand what the field is for.  What I need to do is when I create a Campaign from the API, I also want to set what the record type should be for CampaignMembers that will get created on that Campaign.  Unfortunately, the field Campaign.CampaignMemberRecordType does not seem to be available from the API and thus my Apex code won't compile.

 

What do I need to do to make it available in Eclipse?

 

Thanks,

Dave

jkucerajkucera

Ah - sorry for the "is your computer plugged in" response. 

 

You're using the wrong field name.  You need to use:

 

CampaignMemberRecordTypeId  

This was selected as the best answer
DavidHabib.ax407DavidHabib.ax407

Thanks!

Dave