You need to sign in to do that
Don't have an account?
Trigger to update field on Campaign from Campaign Member failing
Hi,
I'm trying to mimic a workflow field update from the Campaign Member to the Campaign (as it cannot be done via a workflow). What I want is when a picklist (Send_tutor_details_to_client__c) is updated to 'First', the contents of another field on the Campaign Member (Tutor_details_for_email__c) are copied to a corresponding field on the Campaign (Tutor_1__c).
I'm getting an error about sObjects, however, that I don't understand.
This is the trigger:
And this is the error:
sObject type 'Interview_Date_Time_Confirmed__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.
Any help would be very welcome, thanks!
I'm trying to mimic a workflow field update from the Campaign Member to the Campaign (as it cannot be done via a workflow). What I want is when a picklist (Send_tutor_details_to_client__c) is updated to 'First', the contents of another field on the Campaign Member (Tutor_details_for_email__c) are copied to a corresponding field on the Campaign (Tutor_1__c).
I'm getting an error about sObjects, however, that I don't understand.
This is the trigger:
trigger UpdateTutor1onCampaign on CampaignMember (after insert, after update) { Map<ID, Campaign> parentCams = new Map<ID, Campaign>(); List<Id> listIds = new List<Id>(); for (CampaignMember childObj : Trigger.new) { listIds.add(childObj.Campaign); } parentCams = new Map<Id, Campaign>([SELECT id, Tutor_1__c Name,(SELECT ID, Send_tutor_details_to_client__c FROM CampaignMember) FROM Campaign WHERE ID IN :listIds]); for (CampaignMember childObj: Trigger:new){ Campaign myParentCams = parentCams.get(childObj.Campaign); myParentCams.Tutor_1__c = childObj.Send_tutor_details_to_client__c; } update parentCams.values(); }
And this is the error:
sObject type 'Interview_Date_Time_Confirmed__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.
Any help would be very welcome, thanks!
here's the corrected version.. hope it works this time
All Answers
couple of changes.. there is a , missing after Tutor_1__c in the SOQL.. also you don't need to query the child records again since you get that in the trigger anyway..
try this version and see if it works for you..
Error: Compile Error: Incompatible element type SOBJECT:Campaign for collection of Id at line 7 column 5
here's the corrected version.. hope it works this time