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
Eli Flores, SFDC DevEli Flores, SFDC Dev 

Cannot update the currencyisocode on campaignmember

I'm trying to build a massLeadConverter for some data clean up and it keeps failing on older campaign members.


I have this stretch of code from an after update trigger on a lead:


for(CampaignMember cm :members) {
    cm.Status = Trigger.newMap.get(cm.LeadId).Status;
    totest = cm.Id;
    if (cm.CurrencyIsoCode != Trigger.newMap.get(cm.LeadId).CurrencyIsoCode){
        system.debug('switching  currency to '+string.valueOf(Trigger.newMap.get(cm.LeadId).CurrencyIsoCode));
        cm.CurrencyIsoCode = Trigger.newMap.get(cm.LeadId).CurrencyIsoCode;
//Important! Available values for status from CampaignMember are assigned dynamically from
//parent Campaign record. Also they can be found as records of CampaignMemberStatus object.
            update members;

 and when  a lead with a currencyisocode of USD associated with a campaign member with a currencyisocode of 000 this this code. I get the debug message switching currencycode to USD but then it bombs out with this error.


First exception on row 0 with id 00v8000000J2fwhAAB; first error: INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST, Currency ISO Code: invalid currency code: 000:


My vf page, controller, and trigger are all on api 25+.


I tried to correct the currencyisocode on the campaign member with Data Loader 25.0.2 and it givesme the  same error.


Then I tried to correct the record by adding the currencyisocode to detail  page. No amount of magic appears to be able to put it on there and make it actually appear.


I have system admin privileges and everything looks right on the permissions.


Anyone have any ideas on why I can't seem to update this field?


Is 000 a valid picklist value for CurrencyISOCode beacuse I ran the below code in Dev console and it worked fine for me :-


Campaign c=[select CurrencyIsoCode from Campaign where id='701e0000000EANX'];
CampaignMember cm=[select CurrencyIsoCode from CampaignMember where CampaignId='701e0000000EANX' limit 1];
update cm;

// I am able to update the CurrencyIsoCode  for CampaignMember