My goal is to configure a trigger on the CampaignMember object in SF that, when fired, will send a marketing cloud email. We are using a Web2Lead form that will pass the campaign value into SF, which should be used to trigger the email to the person that submitted the form.
In configuring the object for triggers in SF, I used this code from the marketing cloud documentation (replacing Object Name with CampaignMember):
trigger Trig_Object Name on Object Name (after insert, after update) {
et4ae5.triggerUtility.automate('Object Name');
}
Now I need to create the test class. This is the code someone sent me, but I think I have the required fields and values incorrect because I'm getting an error (I replaced 'field1 = 'test1" with 'Campaign=Event_1' and deleted field2 and 3):
@isTest(Seealldata = true)
public class Trig_CampaignMemberTest {
static testmethod void InsertCampaignMember() {
CampaignMember cmp = new CampaignMember('field1' = 'test1', 'field2' = 'test2','field3' = 'test3');
Insert cmp;
}
}
I received this error: Compile Error: SObject constructor must use name=value pairs at line 5 column 22
Am I missing something? Any feedback is highly appreciated. I'm new to this!