You need to sign in to do that
Don't have an account?

Initial term of field expression must be a concrete SObject: LIST<Contact> at line 23 column 34.
I am getting Error at the line 23 which is in Bold below
(ContactId = c.Id,CampaignId = '7018000tyyy'));
Here is the whole code
(ContactId = c.Id,CampaignId = '7018000tyyy'));
Here is the whole code
trigger triggerContactCreateCampMember on Contact (after update) { List<CampaignMember> CampaignMember = new List<CampaignMember>(); List<Contact> ContactsToAdd = new List<Contact>(); Set<Id> contId= new Set<Id>(); if(Trigger.isUpdate) //Store Contact ID for(Contact contact: Trigger.new) { if (contact.LeadSource =='Web' ) contId.add(contact.ID); } List<Contact> c = new List<Contact> ([SELECT c.Id,c.AccountId From Contact c WHERE Id IN :contId]); for (Contact con : c) { if(contId.size() > 0) { CampaignMember.add(new CampaignMember (ContactId = c.Id,CampaignId = '7018000tyyy')); insert CampaignMember; } } }
I would start with your capmaignID.
That's 11 characters., Valid Salesforce IDs are either 15 or 18 characters long.
So your error likely is implying that your trying to set an ID for a Salesforce Record that is invalid. Double check your value and make sure you're pasting a valid ID.
All Answers
I would start with your capmaignID.
That's 11 characters., Valid Salesforce IDs are either 15 or 18 characters long.
So your error likely is implying that your trying to set an ID for a Salesforce Record that is invalid. Double check your value and make sure you're pasting a valid ID.
c is your list variable and con are the items within it.